Gen 4 VPS & Dedicated Servers Help

Install the Memcached PHP libraries on Plesk Linux

Memcached is a free and powerful object caching system that you can install to improve the performance of your website. Memcached will only work if you install the daemon, install the PHP libraries and configure your PHP application properly.

The PHP libraries for Memcached are installed over the command line. You'll need to be logged in as the root user to run these commands.

  1. Enable administrator access on your Gen 3 or Gen 4 server if you haven't already done so.
  2. Connect to my server with SSH (Secure Shell).
  3. Switch to the root user.
  4. Install the required dependencies
    • CentOS users:
      yum -y install gcc glibc-devel libmemcached-devel zlib-devel plesk-php*-devel
    • AlmaLinux users:
      yum groupinstall "Development Tools"
    • Ubuntu users:
      apt install autoconf automake gcc libmemcached-dev libhashkit-dev pkg-config plesk-php*-dev zlib1g-dev
  5. Install the PHP PECL library for the desired version of PHP. You'll need to do this for each version of PHP you're using.
    /opt/plesk/php/7.4/bin/pecl install memcached

    You'll be prompted several times while the software installs. Unless you have a specific need, press "enter" to accept the default value in each case.

    Note: In some situations, you may see an error like this:

    shtool at '/tmp/memcached/build/shtool' does not exist or is not executable. Make sure that the file exists and is executable and then rerun this script. ERROR: `phpize' failed

    If this happens, configure PHP to use a different temporary directory and re-run the command.

    mkdir /root/tmp && /opt/plesk/php/7.4/bin/pear config-set temp_dir /root/tmp /opt/plesk/php/7.4/bin/pecl install memcached

  6. Register the module in PHP.

    echo "" > /opt/plesk/php/7.4/etc/php.d/memcached.ini
  7. Update Plesk's PHP handler.

    plesk bin php_handler --reread
  8. Finally, restart Apache and PHP-FPM.

    systemctl restart httpd
    systemctl restart plesk-php74-fpm
    • Ubuntu users:
      systemctl restart apache2
      systemctl restart plesk-php74-fpm

Related Steps

More info

  • Our server experts can perform these steps for a fee. For more information about our Expert Services, please visit our Expert Service menu.

Share this article