How to configure PHP to use memcached unix socket?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm in the process of upgrading from Ubuntu Server 16.04 to 18.04 and at the same time upgrading from PHP 5.6 to PHP 7.3.
In /etc/memcached.conf
I added:
-s /tmp/memcached.sock
-a 666
When I restart the service, I see:
srw-rw-rw- 1 memcache memcache 0 Nov 13 03:44 /tmp/systemd-private-7fc3b73707084a93bcc6abd22001eb7e-memcached.service-oIF206/tmp/memcached.sock=
How can I configure PHP to know where the unix socket is?
ubuntu systemd unix-sockets memcached
add a comment |
up vote
0
down vote
favorite
I'm in the process of upgrading from Ubuntu Server 16.04 to 18.04 and at the same time upgrading from PHP 5.6 to PHP 7.3.
In /etc/memcached.conf
I added:
-s /tmp/memcached.sock
-a 666
When I restart the service, I see:
srw-rw-rw- 1 memcache memcache 0 Nov 13 03:44 /tmp/systemd-private-7fc3b73707084a93bcc6abd22001eb7e-memcached.service-oIF206/tmp/memcached.sock=
How can I configure PHP to know where the unix socket is?
ubuntu systemd unix-sockets memcached
You have made tests right? Most of the sites written for php 5 breaks in php 7
– Rui F Ribeiro
20 hours ago
@RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
– Paul
12 hours ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm in the process of upgrading from Ubuntu Server 16.04 to 18.04 and at the same time upgrading from PHP 5.6 to PHP 7.3.
In /etc/memcached.conf
I added:
-s /tmp/memcached.sock
-a 666
When I restart the service, I see:
srw-rw-rw- 1 memcache memcache 0 Nov 13 03:44 /tmp/systemd-private-7fc3b73707084a93bcc6abd22001eb7e-memcached.service-oIF206/tmp/memcached.sock=
How can I configure PHP to know where the unix socket is?
ubuntu systemd unix-sockets memcached
I'm in the process of upgrading from Ubuntu Server 16.04 to 18.04 and at the same time upgrading from PHP 5.6 to PHP 7.3.
In /etc/memcached.conf
I added:
-s /tmp/memcached.sock
-a 666
When I restart the service, I see:
srw-rw-rw- 1 memcache memcache 0 Nov 13 03:44 /tmp/systemd-private-7fc3b73707084a93bcc6abd22001eb7e-memcached.service-oIF206/tmp/memcached.sock=
How can I configure PHP to know where the unix socket is?
ubuntu systemd unix-sockets memcached
ubuntu systemd unix-sockets memcached
edited 11 hours ago
asked 22 hours ago
Paul
1138
1138
You have made tests right? Most of the sites written for php 5 breaks in php 7
– Rui F Ribeiro
20 hours ago
@RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
– Paul
12 hours ago
add a comment |
You have made tests right? Most of the sites written for php 5 breaks in php 7
– Rui F Ribeiro
20 hours ago
@RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
– Paul
12 hours ago
You have made tests right? Most of the sites written for php 5 breaks in php 7
– Rui F Ribeiro
20 hours ago
You have made tests right? Most of the sites written for php 5 breaks in php 7
– Rui F Ribeiro
20 hours ago
@RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
– Paul
12 hours ago
@RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
– Paul
12 hours ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
systemd has PrivateTmp=true
for memcached.service
One way would be to override PrivateTmp
, specifically for the memcached.service
, i.e.
mkdir -p /etc/systemd/system/memcached.service.d
echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf
echo "PrivateTmp=false" >> /etc/systemd/system/memcached.service.d/override.conf
systemctl daemon-reload
systemctl restart memcached
That would change the memcached.service back to using /tmp
, rather than /tmp/systemd-private-...
Assuming you want to use memcached for session handling; Once you've verified that /tmp/memcahced.sock
exists with the correct permissions, in /etc/php.ini
or /etc/php/conf.d/memcached.ini
change session support.
[Session]
extension=memcached.so
session.save_handler="memcached"
session.save_path="/tmp/memcached.sock"
If it exists, comment out session.save_handler=files
.
FWIW, if it's on the Internet, and given it's memcached which has been exploited a lot recently, disabling UDP and binding explicitly to 127.0.0.1 would be worth additional consideration, i.e. add these to your memcached options -U 0 -l 127.0.0.1
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
systemd has PrivateTmp=true
for memcached.service
One way would be to override PrivateTmp
, specifically for the memcached.service
, i.e.
mkdir -p /etc/systemd/system/memcached.service.d
echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf
echo "PrivateTmp=false" >> /etc/systemd/system/memcached.service.d/override.conf
systemctl daemon-reload
systemctl restart memcached
That would change the memcached.service back to using /tmp
, rather than /tmp/systemd-private-...
Assuming you want to use memcached for session handling; Once you've verified that /tmp/memcahced.sock
exists with the correct permissions, in /etc/php.ini
or /etc/php/conf.d/memcached.ini
change session support.
[Session]
extension=memcached.so
session.save_handler="memcached"
session.save_path="/tmp/memcached.sock"
If it exists, comment out session.save_handler=files
.
FWIW, if it's on the Internet, and given it's memcached which has been exploited a lot recently, disabling UDP and binding explicitly to 127.0.0.1 would be worth additional consideration, i.e. add these to your memcached options -U 0 -l 127.0.0.1
add a comment |
up vote
1
down vote
systemd has PrivateTmp=true
for memcached.service
One way would be to override PrivateTmp
, specifically for the memcached.service
, i.e.
mkdir -p /etc/systemd/system/memcached.service.d
echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf
echo "PrivateTmp=false" >> /etc/systemd/system/memcached.service.d/override.conf
systemctl daemon-reload
systemctl restart memcached
That would change the memcached.service back to using /tmp
, rather than /tmp/systemd-private-...
Assuming you want to use memcached for session handling; Once you've verified that /tmp/memcahced.sock
exists with the correct permissions, in /etc/php.ini
or /etc/php/conf.d/memcached.ini
change session support.
[Session]
extension=memcached.so
session.save_handler="memcached"
session.save_path="/tmp/memcached.sock"
If it exists, comment out session.save_handler=files
.
FWIW, if it's on the Internet, and given it's memcached which has been exploited a lot recently, disabling UDP and binding explicitly to 127.0.0.1 would be worth additional consideration, i.e. add these to your memcached options -U 0 -l 127.0.0.1
add a comment |
up vote
1
down vote
up vote
1
down vote
systemd has PrivateTmp=true
for memcached.service
One way would be to override PrivateTmp
, specifically for the memcached.service
, i.e.
mkdir -p /etc/systemd/system/memcached.service.d
echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf
echo "PrivateTmp=false" >> /etc/systemd/system/memcached.service.d/override.conf
systemctl daemon-reload
systemctl restart memcached
That would change the memcached.service back to using /tmp
, rather than /tmp/systemd-private-...
Assuming you want to use memcached for session handling; Once you've verified that /tmp/memcahced.sock
exists with the correct permissions, in /etc/php.ini
or /etc/php/conf.d/memcached.ini
change session support.
[Session]
extension=memcached.so
session.save_handler="memcached"
session.save_path="/tmp/memcached.sock"
If it exists, comment out session.save_handler=files
.
FWIW, if it's on the Internet, and given it's memcached which has been exploited a lot recently, disabling UDP and binding explicitly to 127.0.0.1 would be worth additional consideration, i.e. add these to your memcached options -U 0 -l 127.0.0.1
systemd has PrivateTmp=true
for memcached.service
One way would be to override PrivateTmp
, specifically for the memcached.service
, i.e.
mkdir -p /etc/systemd/system/memcached.service.d
echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf
echo "PrivateTmp=false" >> /etc/systemd/system/memcached.service.d/override.conf
systemctl daemon-reload
systemctl restart memcached
That would change the memcached.service back to using /tmp
, rather than /tmp/systemd-private-...
Assuming you want to use memcached for session handling; Once you've verified that /tmp/memcahced.sock
exists with the correct permissions, in /etc/php.ini
or /etc/php/conf.d/memcached.ini
change session support.
[Session]
extension=memcached.so
session.save_handler="memcached"
session.save_path="/tmp/memcached.sock"
If it exists, comment out session.save_handler=files
.
FWIW, if it's on the Internet, and given it's memcached which has been exploited a lot recently, disabling UDP and binding explicitly to 127.0.0.1 would be worth additional consideration, i.e. add these to your memcached options -U 0 -l 127.0.0.1
edited 6 hours ago
answered 11 hours ago
Joseph Tingiris
1136
1136
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481372%2fhow-to-configure-php-to-use-memcached-unix-socket%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
You have made tests right? Most of the sites written for php 5 breaks in php 7
– Rui F Ribeiro
20 hours ago
@RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
– Paul
12 hours ago