Introduction

Memcached is a cache server that, unlike some PHP accelerators, does not consume additional CPU. It’s therefore an ideal compromise. For WordPress, there is currently no simple solution to quickly set up this solution (although it’s not very time-consuming anyway).

Installation

On Debian, it’s easy:

  apt-get install memcached
  

Your memcached server is now running on port 11211.

Configuration

Server

Nothing special needs to be done, the basic configuration is sufficient.

WordPress

Go to the wp-content folder of your WordPress, then download these files and set the proper permissions:

  cd ./wp-content
wget http://svn.wp-plugins.org/memcached/branches/1.0/memcached-client.php
wget http://svn.wp-plugins.org/memcached/branches/1.0/object-cache.php
chown www-data. memcached-client.php object-cache.php
cd ..
  

Then modify the WordPress configuration file wp-config.php and add this line (wp-config.php):

  $memcached_servers = array('127.0.0.1:11211');
  

If you have multiple memcached servers, here’s the syntax to use (wp-config.php):

  $memcached_servers = array('192.168.1.1:11211', '192.168.1.2:11211');
  

Resources

Last updated 08 Sep 2009, 21:38 CEST. history