How to configure Magento to use Memcached

In this tutorial we will explain how to configure your Magento application to use Memcached. The Magento application natively supports Memcached. This means that you just need to enable this option. In order to do this you have to edit the Magento XML configuration file - local.xml.

This file is stored inside the web root folder. For example, if your website is accessible at:

this means that the local.xml file is in your public_html/magento/app/etc folder. In order to edit the file you can use the cPanel File Manager.

Open the file and find the following line of code (usually this is also the end of the file):


Right before this line add the following lines:

<!-- apc / memcached / empty=file -->
<!-- memcached cache backend related config -->
<!-- any number of server nodes can be included -->

Please note that you should replace port number 11211 with the correct port number for your hosting account.

For more details how to find out the correct port please check the following tutorial:

Enable Memcached from cPanel

After that save the file. The following screenshot shows how to edit the file via the cPanel File Manager -> Code Editor Tool:

That's it - your Magento application is now correctly configured. From now on the e-commerce app will use Memcached to cache certain API calls, database calls and objects.