How to configure Drupal to use Memcached
In this tutorial we will explain how to configure your Drupal application to use Memcached. By default, Drupal does not provide Memcached support. That is why you have to install a third party module which can be used by the Drupal system to connect to the Memcached service. You need to install Memcache API and Integration.
For more details about the module please check this page:
If your Drupal application is version 7.x you can install the module directly from your Drupal administrative area. Older Drupal applications (6.x) do not provide this functionality and you need to manually download the module to your computer. Then you have to upload the module to your account and extract the archive file. For more details how to manually install modules please read this tutorial.
The next paragraphs illustrate how to install the Memcache API and Integration module on Drupal version 7.x.
First, you have to access your Drupal administrative area at:
Please note that you should replace yourdomain.com with your own domain name.
You should see the Drupal login page:
Type your username and password and then click the "Log In" button. The next page which will be displayed on your end is the Drupal Dashboard which allows you to manage your website.
To install the Memcache API and Integration module go to Modules:
The system will open a new page. You will see all the installed modules and a link called "Install new module".
Click on it, so that you will be able to install the Memcached module:
You will be redirected to the module installation page. You will see a text field called "Install from a URL". In this field you should paste the link to the Memcache API and Integration module download link.
At the time of writing this tutorial the latest version of the module is 7.x-1.0 and the download link is:
You have to paste this link in the "Install from a URL" field and then click the "Install" button:
At this stage the Memcache API and Integration module is installed. This means that now your Drupal application supports Memcached.
You should be redirected to the following page:
The last step is to enable the module from your Drupal administrative area -> Modules section. Before you do this you need to edit the module's files and configure it to use the correct hostname and port combination.
For more details how to find out the correct details please check the following tutorial:Enable Memcached from cPanel
In our example, the correct details are:
Memcached IP address: 127.0.0.1Memcached Port: 20006
Please note that when you enable Memcached the system will randomly generate a port for you. You should remember the port number.
The next step is to manually edit the following two files on your account:
You have to find the following text string in the code:
127.0.0.1:11211and replace it with:127.0.0.1:20006
As you can see the idea is to replace the default Memcached port (11211) with the correct port for your account.
You can now access your Drupal administrative area and enable the Memcached module from the Modules menu: