Memcached issue : memcache loaded could not connect on Cpanel server

Recently we have compile Apache with memcache php module and the module was also enabled in the php.ini file but sometimes it shows the error below :

memcache loaded could not connect

To resolve the error you need to start the memcache and open the port number 11211 which is the default port number of memcache.

We can enable it by using the below command :

#memcached -d -u nobody -m 1024 127.0.0.1 -p 11211

Once memcahed started , We can check the port number is opened or not by using the below command:

#netstat -nap | grep 11211

Output will be as follows:

root@vps [~]# netstat -nap | grep 11211
tcp 0 0 127.0.0.1:51625 127.0.0.1:11211 TIME_WAIT -
tcp 0 0 127.0.0.1:51624 127.0.0.1:11211 TIME_WAIT -
tcp 0 0 :::11211 :::* LISTEN 23327/memcached
udp 0 0 0.0.0.0:11211 0.0.0.0:* 23327/memcached

It will resolve theĀ error.