memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

grab your specific RPM and install it:

rpm –install rpmforge-release-*.rpm

yum install –enablerepo=rpmforge memcached

Now memcached is installed.

You can test it:

memcached -m 512 -u nobody -vv

First, you start up the memcached daemon on as many spare machines as you have. The daemon has no configuration file, just a few command line options, only 3 or 4 of which you’ll likely use:

./memcached -d -m 2048 -l -p 11211 -u nobody

This starts memcached up as a daemon, using 2GB of memory, and listening on IP, port 11211. The -m switch specifies the amount of memory in megabytes. The -l switch specifies the IP to listen on and finally the -p switch specifies the port to listen on. The default port is 11211 and if your machine has just 1 IP you can omit the -l parameter. In the above example I set the amount of memory to 2GB. Of course you should use a sensible amount of memory. Making your machine swap to disk sort of defeats the purpose of a memory cache daemon.

Installation of the PHP MemCache extension:

cd /files/download/


tar -xvf memcache-2.1.2.tgz

cd memcache-2.1.2

phpize && ./configure –enable-memcache && make

Copy the file to the default module directory.

vi /etc/php.ini


/etc/init.d/httpd restart

If you check your phpinfo() you should see a MemCache section appear.

You can now fully use the MemCache functionality in your PHP

Post By Editor (2,827 Posts)

Website: →