How to install and configure memcache on CentOS 5.7 for Drupal

Memcached, a general-purpose distributed memory caching system, is often used with drupal to significantly increse site's performance by putting the Drupal cache tables into RAM. Here are the steps that I took to install it on CENTOS 5.7

Install libevent:

wget --no-check-certificate https://github.com/downloads/libevent/libevent/libevent-2.0.15-stable.tar.gz
tar -zxvf  libevent-2.0.15-stable.tar.gz
cd libevent-2.0.15-stable
./configure
make
make install
cd ../

Install memcached:

wget http://memcached.googlecode.com/files/memcached-1.4.9.tar.gz
tar -zxvf memcached-1.4.9.tar.gz
cd memcached-1.4.9
./configure --with-libevent=/usr/local/
make
make install
cd ../

Install Memcache PHP extention:

wget http://pecl.php.net/get/memcache-3.0.6.tgz
tar -zxvf memcache-3.0.6.tgz
<code>

phpize
./configure
make
make install
cd ../

Add the following line to your php.ini file (/etc/php.ini):

extension = “memcache.so”

Start memcacheed server:

memcached -d -m 512 -u root -l 127.0.0.1 -p 11211

The above starts memcahcache on localhost on port 11211 with 512Mb of RAM.

See if mecached is running:

ps aux | grep memcached

Download and install the drupal memcache module from drupal.org for your version of Drupal and follow the instructions included in the INSTALLATION.txt file

Comments

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.

More information about formatting options

11 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.