Memcached is a general-purpose distributed memory caching system. It can be used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times database must be read.

Please make sure that Memcached port is opened and access is allowed only to desired servers. If the memcached port is left open to all any one can connect to it and access the data objects.

1) Install libevent

libevent is required to install memcached

# yum install libevent-devel libevent

2) Install memcached

# cd /usr/local/src
# wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
# tar -zxvf memcached*
# cd memcached*
# ./configure
# make
# make install

3) Run memcached as a daemon and make it listen on default port

Create a user,
# useradd memcache

Use the below command to run memcached
# memcached -u memcache -p 11211 &

To use memcahe with PHP on the same server , you can install it with

# pecl install memcache

Make sure that below line is added to main php.ini
extension=memcache.so
To load the module and reflect the changes restart  apache

# /usr/local/apache/bin/apachectl restart