I am running Arch linux with systemd, nginx, and php with php-fpm. I am trying (and failing) to configure memcached to store sessions using a unix socket. I have memcached installed and active, however, I am unable to disable networking. I added the following line to /etc/conf.d/memcached
MEMCACHED_ARGS="-s unix:///tmp/memcached.sock -a 666"
I also tried:
MEMCACHED_ARGS="-s /tmp/memcached.sock -a 666"
MEMCACHED_ARGS="-s unix:/tmp/memcached.sock -a 666"
when I restart memcached I always get:
memcached.service - Memcached Daemon
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled)
Active: active (running) since Sat 2013-01-19 17:41:15 PST; 5min ago
Main PID: 773 (memcached)
CGroup: name=systemd:/system/memcached.service
└─773 /usr/bin/memcached -l 127.0.0.1
when I run php script with sessions php error log shows (not surprisingly):
[19-Jan-2013 16:46:45 America/Los_Angeles] PHP Warning: Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (unix:/tmp/memcached.sock) in Unknown on line 0
I also installed the php-memcached package but I don't what it does or how to get it going. I uncommented the following line in /etc/php/conf.d/memcached.ini:
extension=memcached.so
but that didn't change anything.
Any insights or suggestions would be greatly appreciated.
Best Answer
Memcached config.d
A file path is all that's needed for Memcached's unix socket.
You can confirm that Memcached is operating normally by running the
stats
command through the unix socket.Configure PHP's session to use Memcached
Edit
php.ini
, or/etc/php/conf.d/memcached.ini
, and add session support.Restart services and verify php logs