I recently updated the Memcached WP Object Cache plugin to use the Memcached PHP extension – it currently uses the Memcache extension. My plugin is called Memcached Redux, and it’s delicious. The Memcached PHP extension implements methods from libmemcached, the C / C++ Memcached library.
Installing the extension on MacPorts is beyond easy:
port install php5-memached
Installing on Amazon EC2 instance running CentOS 5 is WAY more esoteric. I spent about 2 hours mucking around until I figured it out, so here it is (this assumes you are already using memcached and have libevent, libzlib, etc installed):
cd /etc/yum.repos.d/ wget http://rpms.famillecollet.com/remi-enterprise.repo wget http://syslogserver.googlecode.com/files/epel-release-5-3.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm yum --enablerepo=remi install libmemcached* pecl install memcached vi /etc/php.ini // (under Dynamic Extensions) Add "extension=memcached.so": extension=apc.so extension=http.so extension=memcache.so extension=memcached.so
Servers have to be restarted – this has be done before code is deployed or the class won’t exist, which will cause a fatal error.
This process looks harmless, but I had to read 3.7 million blog posts before I found the right path forward.