Is Memcached working?
If you're not sure if Memcached has been installed correctly, you can run some simple tests to make sure everything is running as it should.
Note: Tests in this guide require you to use SSH. To get started, you'll need to enable administrator access on your Gen 3 or Gen 4 server (if you haven't already done so), connect with SSH and switch to the root user.
Is Memcached installed?
Check if the Memcached service is installed, running, and listening on port 11211.
telnet localhost 11211
This should report back that it was able connect to the service.
[root@server[~]: telnet localhost 11211 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'.
If it's not installed correctly, you won't be able to connect to the service.
[root@transfer[~]: telnet localhost 11211 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
Is it enabled on my site?
Use an info.php file on your site to check for the presence of the required PHP libraries.
You can also verify the installation from SSH.
Note: Make sure to use the same version of PHP as the site you want to use Memcached on.
In a server with WHM/cPanel, PHP version 7.3, this command should return this output (only the first few lines are shown):
[root@server[~]: ea-php73 -i | grep "memcached" /opt/cpanel/ea-php73/root/etc/php.d/memcached.ini, memcached memcached support => enabled
In a server with Plesk, PHP version 7.3, this command should return this output (only the first few lines are shown):
[root@6266-7xsm ~]# /opt/plesk/php/7.3/bin/php -i | grep "memcached" /opt/plesk/php/7.3/etc/php.d/memcached.ini, memcached memcached support => enabled
If the PHP library is not installed, no output is returned when running the command.
Is the Memcached service and PHP libraries working?
Verify that the memcached service and the memcached PHP libraries are working together and caching is functioning as expected.
From the command line, telnet to the Memcached service.
[root@server ~]# telnet localhost 11211
This output will be returned, and you will be connected to the Memcached service.
Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'.
Enter the command stats. A full page of output will appear, but towards the middle, look for the lines STAT bytes_read and STAT bytes_written.
stats STAT pid 6374 STAT uptime 37567 ... ... STAT bytes_read 3733268975 STAT bytes_written 6526192728 STAT limit_maxbytes 1073741824 ... ... END
In this case, with a large amount of data being read and written, Memcached is working as expected. Entering the command stats again should show changes to these values.
If you are seeing an extremely small amount of data read and written, or values of 0, Memcached is not functioning properly.
stats STAT pid 30601 STAT uptime 603941 ... ... STAT bytes_read 7 STAT bytes_written 0 STAT limit_maxbytes 1073741824 ... ... END
You should be able to use quit to return to a standard SSH prompt.
quit Connection closed by foreign host. [root@server ~]#
- Return to Install the Memcached PHP Libraries using WHM.
- Return to Install the Memcached PHP Libraries using Plesk.
- Return to configure your site to use Memcached.
- Our server experts can perform these steps for a fee. For more information about our Expert Services, please visit our Expert Service menu.