Enable Memcached on Remi based PHP install for WordPress

The php stack I am using for blogs and other hosted php websites is from Remi. I am on PHP version 5.6. The memcached plugin was enabled and I never checked its status. I only found out that the memcached is not enabled at all on my websites.

OK I figured this will be a simple task. It is. There are a few things that you need to be cautious about if you are using Remi as php base. The modules will not be loaded magically.

Three steps:
1. Copy or link the module to your system library, you need to do the same for 3 files for PHP 5.x: igbinary.so, memcached.so and msgpack.so

for i in igbinary.so memcached.so msgpack.so
do
  ln -s /opt/remi/php56/root/usr/lib64/php/modules/$i /usr/lib64/php/modules/$i
done

For PHP 7 you do not need the igbinary file.

2. Add the following modules to /etc/php.d directory using ordering, each of the file contains only a line of extension = xxx.so
20-msgpack.ini

extension = msgpack.so

20-igbinary.ini

extension = igbinary.so

30-memcached.ini

extension = memcached.so

3. Restart php-fpm
Depend on your configuration, you might not be using php-fpm. Restart it so that the changes can apply to your website.

When you go to Tools -> Memcached in WordPress, you shall see this line:
Using the PHP Memcached class to interact with Memcached

It proves that you are using Memcached!

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.