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.
- Enable administrator access on your Gen 3 or Gen 4 server if you haven't already done so.
- Connect to my server with SSH (Secure Shell).
- Switch to the root user.
- Install the required dependencies using YUM.
yum -y install gcc glibc-devel libmemcached-devel zlib-devel plesk-php*-devel
- 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.3/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.3/bin/pear config-set temp_dir /root/tmp /opt/plesk/php/7.3/bin/pecl install memcached
Register the module in PHP.
echo "extension=memcached.so" > /opt/plesk/php/7.3/etc/php.d/memcached.ini
Finally, restart Apache and PHP-FPM.
systemctl restart httpd systemctl restart plesk-php73-fpm
- Our server experts can perform these steps for a fee. For more information about our Expert Services, please visit our Expert Service menu.