PHP API Unix Socket Connect

Mikael Johansson mikael at
Sun Oct 15 18:42:06 UTC 2006

The CVS version of pecl/memcache now supports unix domain sockets, you
can checkout and build a copy as

 cvs -d :pserver:cvsread at checkout pecl/memcache
 cd pecl/memcache
 make install

Connect to the server like

 $memcache = new Memcache();
 $memcache->addServer('unix:///var/run/memcached/memcached.sock', 0);

Please note that the port number must be set to 0 (otherwise it defaults
to 11211.) The socket must also be writable by the user your script run
as, for example the webserver user.


Craig Wood wrote:
> Has anyone seen, used or heard of the unix socket connection being used
> successfully with PECL's PHP memcache API or any other PHP memcache API ?

More information about the memcached mailing list