Install Memcached on cPanel Server

Login to WHM as user root, go to Terminal or login to SSH as user root. Then run the command

Enable memcached to start on boot.

Configure memcached

Default configuration on AlmaLinux 9 look like the following

edit configuration file

Lets change cache size to 128 mb


Replace 64 with 128

In AlmaLinux 9, memcached only listen on loop back interface IP address (,::1). If your configuation don’t restrict memcache to listen to, change your options line as follows.

This will restrict memcached to listen on IP address and -U 0 disable UDP. This is done to protect memcachd installation from attacks.

Restart memcached with

To verify memcached is running, run

We have memcached listening on

Now we have memcached deamon running. We need PHP module installed.

Installing memcached PHP module

To list all available memcached PHP module, run

list memcache php modules

To install memcache module for PHP 8.2, run

For PHP 8.0, install package ea-php80-php-memcached, similarly, for PHP 8.1 install ea-php81-php-memcached.

If you use CloudLinux PHP selector, memcached is already installed on the system. You can enable the module using PHP Selector.

Back to memcached

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *