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.
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.)
Retrieve the IUS Community repository installation files to allow an easy install of the memcache module from the IUS repo.
Browse the repo at http://dl.iuscommunity.org/pub/ius/stable/Redhat/ to make certain you have the right files for your server:
This example is for 64 bit Red Hat Enterprise Linux (RHEL) 5 and is current as of 2014-03-04:
This example is for 32 bit Red Hat Enterprise Linux (RHEL) 5 and is current as of 2014-03-04:
This example is for 64 bit Red Hat Enterprise Linux (RHEL) 6 and is current as of 2014-03-04:
This example is for 32 bit Red Hat Enterprise Linux (RHEL) 6 and is current as of 2014-03-04:
CENTOS 7 64 bit
Install both of these files:
rpm -ivh *.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:
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.