Installing the memcached PHP module for PHP 7 on Plesk

To install the PHP memcached module for PHP 7 on a Plesk 12.5 server running CentOS 6.8. Please note that this should also work on CentOS 7.

We’re going to need to install the libmemcached dev package first:

sudo yum install -y libmemcached-devel

Next install the PHP 7 dev package. Since this is a Plesk server we install the Plesk version of this package:

yum install -y plesk-php70-devel

After installing these, cd to a temporary directory and clone the memcached module git repo and checkout the php7 branch:

cd /tmp
git clone https://github.com/php-memcached-dev/php-memcached.git
git checkout php7

Next build the memcached module. Make sure to use the PHP 7 version of phpize and point to the PHP 7 version of php-config in the configure command:

/opt/plesk/php/7.0/bin/phpize
./configure --disable-memcached-sasl --with-php-config=/opt/plesk/php/7.0/bin/php-config
make
sudo make install

The module has been built and installed now. Now you only have to enable it:

cd /opt/plesk/php/7.0/etc/php.d
echo "extension=memcached.so" > memcached.ini

Finally restart the webserver for the changes to take effect:

sudo apachectl restart

To make sure the module is loaded you can run:

/opt/plesk/php/7.0/bin/php -m

memcached should show up in the list of modules.