How to Install Memcached on cPanel/WHM server Print

  • 0

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, run the following command:

yum -y install ea-php*-php-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

OPTIONS="-l 127.0.0.1"

Start Memcached:

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.


Was this answer helpful?

« Back

Send Message