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

yum install memcached

Enable memcached to start on boot.

systemctl enable memcached

Configure memcached

Default configuration on AlmaLinux 9 look like the following


edit configuration file

vi /etc/sysconfig/memcached

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.

OPTIONS="-l -U 0"

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

systemctl restart memcached

To verify memcached is running, run

[root@server1 ~]# netstat  -lntp | grep memc
tcp        0      0*               LISTEN      2224258/memcached   
[root@server1 ~]# 

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

yum search php-memcached

list memcache php modules

To install memcache module for PHP 8.2, run

yum install -y ea-php82-php-memcached

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 *