How to: Install MemCached on CentOS / Redhat using yum
Installing memcached on a server for use with W3Total cache can seem daunting if you haven't done it before. Once you've done it enough to work out a method and know the speed bumps you can come across, you can
Use this command to determine the CentOS/RedHat version. You need this to know if you are working with version 4 5 or 6.
cat /etc/redhat-release
Use this command to determine if the OS is 64bit or 32bit (look for x64 if it is not there, 99% of the time you're on 32 bit)
uname -a
Retrieve the IUS Community repository installation files to allow an easy install of the memcache module from the IUS repo.
NOTE: These are examples for 64 bit Redhat 5. Browse the repo at http://dl.iuscommunity.org/pub/ius/stable/Redhat/ to make certain you have the right files for your server: (current as of 10/10/12)
mkdir ~/temp
cd ~/temp
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-10.ius.el5.noarch.rpm
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm
NOTE: These ALTERNATE examples are for 32 bit Redhat 5. Browse the repo at http://dl.iuscommunity.org/pub/ius/stable/Redhat/ to make certain you have the right files for your server: (current as of 10/10/12)
mkdir ~/temp
cd ~/temp
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-10.ius.el5.noarch.rpm
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/epel-release-5-4.noarch.rpm
Install both of these files:
rpm -Uvh *-release-*.rpm
Perform the install:
yum -y install memcached
service memcached start
chkconfig memcached on
pecl install memcache
Note: If you get a "Can't compile c code" error, try making your tmp folder executible before running the pecl command:
mount -o,remount,rw,exec /var/tmp
Make sure you remount the tmp directory securely with noexec when you are done:
mount -o,remount,rw,noexec /var/tmp
Make sure this line has correctly been added to the php.ini file for your site:
extension="memcache.so"
Sometimes the php.ini file has been overridden for a specific directory. Look for that if phpinfo() tells you memcache is not active. This picture shows a site with the default php.ini overridden by a local copy. It required the extension line to be manually added to the overriding ini file.

October 22nd, 2012 - 14:47
test1
October 22nd, 2012 - 14:51
test2
October 22nd, 2012 - 14:55
test3
October 22nd, 2012 - 14:58
test4