How to install/uninstall memcache and memcached PHP modules on Plesk server?

Created:

2016-12-18 06:53:53 UTC

Modified:

2017-08-14 15:21:21 UTC

3

Was this article helpful?


Have more questions?

Submit a request

How to install/uninstall memcache and memcached PHP modules on Plesk server?

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk Onyx for Linux

Question

How to install/uninstall memcache and memcached PHP modules on Plesk server?

Answer

Before installation make sure that epel and ius repositories are installed, e.g. for CentOS 6:

# yum install epel-release
# wget https://centos6.iuscommunity.org/ius-release.rpm
# rpm -Uvh ius-release*.rpm

I. Installation

Note: For other PHP versions, correct the commands where necessary.
Note: Make sure that /tmp is mounted without noexec option.
  1. Install the following packages:
    For CentOS 6:

    # yum install plesk-php56-devel zlib-devel libmemcached10-devel gcc

    For CentOS 7:
    # yum install plesk-php56-devel zlib-devel libmemcached-devel gcc

    For Debian 8:
    apt-get install libmemcached-dev libhashkit-dev plesk-php70-dev build-essential zlib1g-dev pkg-config
  2. Install modules:

        # /opt/plesk/php/5.6/bin/pecl install memcache

    Different memcached versions have different dependencies:

    php-memcached 3.x:

    • Supports PHP 7.0 - 7.1.
    • Requires libmemcached 1.x or higher.
    • Optionally supports igbinary 2.0 or higher.
    • Optionally supports msgpack 2.0 or higher.

    php-memcached 2.x:

    • Supports PHP 5.2 - 5.6.
    • Requires libmemcached 0.44 or higher.
    • Optionally supports igbinary 1.0 or higher.
    • Optionally supports msgpack 0.5 or higher.

     

    Note: memcache is not officially supported in PHP versions 7 and higher.

    for PHP 7.0 and 7.1 use the following commands:

        # /opt/plesk/php/7.0/bin/pecl install memcached
        
    # /opt/plesk/php/7.1/bin/pecl install memcached

    for PHP 5.6 and lower:
       #/opt/plesk/php/5.6/bin/pecl install memcached-2.2.0
      
  3. Register modules in Plesk:

    # echo "extension=memcache.so" > /opt/plesk/php/5.6/etc/php.d/memcache.ini
    # echo "extension=memcached.so" > /opt/plesk/php/5.6/etc/php.d/memcached.ini
  4. Refresh PHP handlers information:

    # plesk bin php_handler --reread

Starting from Plesk Onyx, Docker support has been implemented - now both PHP modules can be installed inside a Docker container.

Note: http(s) proxy rules should be configured for a container to map to a web application.

For including memcache and memcached modules into Plesk PHP packages, check the following thread on Plesk User Voice.

II. Uninstallation

  1. Remove memcached.ini file:

    # rm /opt/plesk/php/5.6/etc/php.d/memcached.ini
  2. Uninstall both modules:

    # /opt/plesk/php/5.6/bin/pecl uninstall memcache
    # /opt/plesk/php/5.6/bin/pecl uninstall memcached
  3. Refresh PHP handlers information:

    # plesk bin php_handler --reread

Additional information

For more information about Docker, see Administrator's guide .

Having trouble with installation? Check this forum thread about memcache and memcached installation.

Have more questions? Submit a request
Please sign in to leave a comment.