How To Install Memcached In WordPress


How To Install Memcached In WordPress

First of all I will tell you some interesting facts about the application itself. It is a very powerful tool specially created for sharing across servers and it’s so good built that even sites like Facebook, Yahoo and other important ones are using it. The main advantage of memcached is that it stores database queries in the server’s memory and it can be shared between more servers, which increases redudancy and decreases CPU usage.

If you install Memcached on WordPress and use a multi-server setup, you can simply reduce the DB queries by 50%. If you are interest and want to give it a try, you can simply install the plugin by following our step-by-step tutorial.

How To Install Memacached:

  1. Install Memcached using this command: sudo apt-get install memcached.

  2. After the installation finishes, you will have to configure Memcached by using a .conf file: vi /etc/memcached.conf.

  3. As you will notice, in the configuration file there will be some parameters. You can leave as default the -d, -u and logfile parameters. Please be careful and change the -m, -p and -i values for your servers. The -l parameter value has to be replaced from to an address of your server. After you have finished configuring enter this command: service memcached restart or /etc/init.d/memcached restart.

How to use Memcached on WordPress:

Next thing to do is to setup WordPress so it can save files using Memcached. You have to follow this address ( ) and install the plugin for WordPress. Keep in mind that you have to copy the files into the wp-content directory and not in the plugins directory.

In order to make Memcached work, you will also have to install another plugin called PECL ( which is a Memcached extension ). You can download it from Now is time to setup WordPress to make us of the Memcached plugin. Please open the wp-config file and enter this command:

global $memcached_servers;
$memcached_servers = array(‘default’ => array(‘memcache-server-ip-or-name:11211?));

Well, that’s about it. The last thing you have to do is to refresh your cache and WordPress should already start save files in Memcache, and your database will be accessed much more faster. Please send us any notes or opinions by leaving a comment below.

Tags: memcached, install, wordpress, plugin, using, files, servers, please, setup, memcached_servers, after, commandâ , save, simply, make, queries, database, directory, thing, enter, parameters, about, address, file, some, restart, wpcontent, server, value, replaced