Install Memcached on cPanel/WHM using easyapache4
By John Quaglieri on July 4th, 2020
In cpanel 11.88 memcached is now available in the easyapache4 yum repo.
This tutorial installs memcache as a service on port 11211. This works for a single site, but memcached has no auth service on this set up so it is not appropriate for multiple separate users. Instead use a memcached socket, which is not covered here.
To install, first find your php version that is being run on the site you want to install memcache. For example on 7.2
yum -y install ea-php72-php-memcached memcached
Enable the service
systemctl enable memcached.service
Edit the config file /etc/sysconfig/memcached
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS=""
change options to listen locally
systemctl start memcached.service
You can now verify with lsof
lsof -i :11211 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME memcached 17880 memcached 26u IPv4 2040097288 0t0 TCP localhost:memcache (LISTEN) memcached 17880 memcached 27u IPv4 2040097289 0t0 UDP localhost:memcache
Memcached is now installed and started.