Installing Memcache For WordPress W3 Total Cache Plugin

Today is a very distracted day. I was busy programming until i lose interest and read up google seo blog. There was this article about google page speed that suddenly makes me feel like speeding up all my website just for some seo benefits. The number one thing i notice about speeding up my website are surrounding caching. Hence, i digged down to my WordPress cache plugin W3 total cache and start exploring him a bit (after 10 months). However i was in a shared environment so the only option other than disk caching would be to install memcache on the server (quite some resources for some speed gain). But it does the trick. My server was using Centos 5.6 with cPanel installed.

Installing Memcache on WordPress Server

Follow the below sequence to get memcache install on your server.

#install require library
yum install libevent libevent-devel
#download the latest memcached. take note i'm downloading version 1.4.6
cd /usr/local/src && wget && tar -xzf memcached-1.4.6.tar.gz && cd memcached-1.4.6
#install it and compile
./configure && make && make install
# make sure memcache starts on boot
touch /etc/init.d/memcached
echo '#!/bin/sh -e' >> /etc/init.d/memcached
echo '/usr/local/bin/memcached -d -m 128 -p 11211 -u nobody -l localhost' >> /etc/init.d/memcached
chmod u+x /etc/init.d/memcached
echo '/etc/init.d/memcached' >> /etc/rc.local
# start memcached
# install memcache
pecl install memcache
# restart apache
/etc/init.d/httpd restart
# test whether we get memcahce
php -r 'phpinfo();' | grep 'memcache'

Upon completing the above steps, you should get yourself the option in W3 total cache plugin to use memcache as an option to use as a cache mechanism.