1

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.

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 systemd to know where the unix socket is?

  • You have made tests right? Most of the sites written for php 5 breaks in php 7 – Rui F Ribeiro Nov 13 '18 at 5:33
  • @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 Nov 13 '18 at 14:01
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.