How to enable Memcache on WordPress
In this guide, we are going to go over how you can configure your WordPress application to work with Memcached by using our proprietary Memcached tool which is available in your CPanel.
The first thing that you would need to do is to access your CPanel with us, as the tools that we are going to use are located within, you can do so from your client area with us, by using the buttons which are shown in the following screenshots :
If for some reason you are unable to access your CPanel, you can submit a ticket to our Genious Support Team, which is available 24/7.
After you have accessed your CPanel, you need to make sure that the “Memcached” PHP extension has been enabled for your hosting account, you can do so from the “Select PHP version” tool which is located in your CPanel, once in there just make sure that the box next to the aforementioned PHP extension has been ticked.
After this has been sorted out you would have to create a Memcache instance by using the “Memcached” tool, once in there you can select the name of your instance its size and whether it uses a socket or TCP/IP connection, for WordPress you would need to select the TCP/IP option, once you have created it please take note of the IP and Port that you will be provided with since we would need them later on.
Once you have created your Memcached instance, you would need to install a plugin which would let you implement Memcached into your WordPress, we can recommend the “Powered Cache” plugin.
After you have installed the aforementioned plugin you would need to instruct the plugin to use Memcache for your Object Caching, you can do so from the drop-down menu next to Object Cache, after this has been done check the box next to “Enable page caching” and click on the “Save Changes” button at the bottom of the screen.
Before your website is fully able to use Memcache one small adjustment needs to be made to your wp-config.php file, you would need to add the following code to the aforementioned file:
$memcached_servers = array( 'default' => array( 'IP:port', 'IP:port' ) );
This line of code can be added to your wp-config.php file in order to instruct your application to connect to the specific port which was provided when the Memcache instance was created, all that you would need to do is copy and paste the IP and Port as they have been provided in the places where IP:Port are present without changing anything else.After you have modified the provided code to correspond to the port which was opened for your use, you can add the code right under the /* That’s all, stop editing! Happy blogging. */ line in your wp-config.php, after you have made the changes the added code should look like this:
/* That's all, stop editing! Happy blogging. */ $memcached_servers = array( 'default' => array( '127.0.0.1:23310', '127.0.0.1:23310' ) );
You can edit the wp-config.php file either by downloading the file over FTP and changing it and then re-uploading it, or you can carry out the changes through the “Edit” option which is available in your “File Manager” tool, you can use this by right-clicking on the selected file and choosing the “Edit” option.
Once all of the above-mentioned actions have been taken, your website would be enjoying the benefits of Memcached.