Lately the WordPress “Site Health” tool is reporting Object Cache as “Recommended”. Using memcache
is one of the most popular solution for this case.
Here are some initial notes:
php-memcache
is a PECL extension;memcached
is a service;php-memcache
andphp-memcached
are two different PECL extensions. Don’t confuse them;- As of this writing
php-memcache
8 is available only for PHP 8+. If your environment still uses PHP 7.4 please remember that it has reached End of Life in 28 Nov 2022; - Enabling Object Cache will increase memory usage (RAM) on your machine;
- It is mandatory for your users to define a private
WP_CACHE_KEY_SALT
key in theirwp-config.php
file. The value must be unique for each WordPress install. This helps prevent cache pollution when multiple WordPress installs are using the samememcached
server. Not defining a key will have unpredictable results.
This tutorial implies that you are:
- Fully understanding what you’re doing and not just copy/pasting commands;
- Using Plesk on Debian, but this can be easily adapted to RPM-based distros;
- Installing
php-memcache
for PHP 8.1, but feel free to replace 8.1 with any other PHP 8.X version that you have installed on your Plesk machine;
Now let’s get to work.
Continue reading →