PECL Memcache memcached.php Statistics Page with Sockets

Thursday, September 6, 2012 - 17:53
  • PHP Logo

If you followed along the previous post on Memcached, sockets and Drupal, or you are just using PECL Memcache, you may be interested in the memcached.php status page that comes with the PECL memcache extension. It is based upon apc.php which comes with APC, and allows you to flush servers and delete values. It also has graphs and I find it to be much better than the memcache_admin module from the Drupal memcache module.

Update: memcache 2.2.7 has been released which fixes support for using sockets. Unfortunately, the version of this file included with memcache 2.2.6 (Found in /usr/share/doc/php-pear/PEAR/memcache/memcache.php in Ubuntu.) does not support connecting to the memcached daemon via sockets. You need to grab the newer version (or use this direct link to current head for SVN for this file here.) which has this bug fixed in this commit over here. I think the bug has been fixed in memcache 3.0.6, so you should be able to use the PECL supplied memcache.php in this case.

  1. // You specify where to find the memcached server socket like this:
  2. $MEMCACHE_SERVERS[] = 'unix:///path/to/memcached/socket';
  3. // Specify the sockets to use like this, if you set it up as in the previous article:
  4. $MEMCACHE_SERVERS[] = 'unix:///var/run/memcached/memcached_myserver.sock';
This file should not be publicly accessible so you will need to set up a username and password as well in memcache.php, do not leave these at their defaults.
Author: Ryan Solomon
Ryan is a partner at desiDev, he likes open source software and QfG meeps.