[HowTo] Install Memcached On Centos 5

Memcached is a free & open source, high-performance, distributed memory object caching system, intended for use in speeding up dynamic web applications by alleviating database load. A WordPress blog with W3 Total Cache plugin support memcached to cache database query and page cache. This will make high visitor blog but low memory and cpu load. Beside using it with WordPress you can use it in your web application as well, read memcached API for more details.

How to install Memcached on Centos 5

Install requirement
1. Open your ssh with root credential.
2. Install libevent libevent-devel

yum install libevent libevent-devel

Download and install memcached
1. Download memcache from http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz or the latest version if available.

wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
tar -xzf  memcached-1.4.5.tar.gz
cd memcached-1.4.5/

2. Configure and install:

./configure --prefix=/opt/memcached
make install

Create init script
1. Get the script from: http://www.ivankristianto.com/downloads/memcached.txt

wget http://www.ivankristianto.com/downloads/memcached.txt
mv -f memcached.txt /etc/init.d/memcached
chmod 750 /etc/init.d/memcached

2. Start memcached:

/etc/init.d/memcached start

3. Put it in rc.local so it will start during boot process:

vim /etc/rc.local
#Add this line:
/etc/init.d/memcached start

Install memcache php extension
1. Get memcache module from http://pecl.php.net/package/memcache

wget -c http://pecl.php.net/get/memcache-2.2.5.tgz
tar -xzf  memcache-2.2.5.tgz
cd memcache-2.2.5/

2. Prepare, compiled, and installed PHP extensions:

make install

3. Now add memcache.so to php.ini:

vim /usr/local/lib/php.ini
#add this line

4. Restart apache

/etc/init.d/httpd restart

5. See if it is installed properly from phpinfo() page:


  1. The check step could be done before starting apache.
    And if you are using drupal, dont forget to set:
    memcache.hash_strategy = “consistent”
    for drupal memcache module.

  2. Its a very good source which is very easy to search on google and also easy to install,thanks to share a great applications with us..

  3. I have already alternate and I am satisfied with that source,thanks for your information..

  4. WFH Market says:

    Its a very to understand installation process,thanks to share this app..

  5. I think It Useing with WordPress you can use it in your web application as well…Thanks

  6. I liked the feature of memcached which is used for speeding up dynamic web applications by alleviating database load.,,,,Thanks for the information.

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.