Configure your website to use Memcached

This article will show you how to configure websites within your Virtual Private Server to use Memcached.

Once you’ve installed the Memcached daemon, you’ll need to set up your PHP application to use Memcached. Otherwise, it will start using your server’s resources without actually doing anything. Simply click the relevant title from the list below and follow the provided instructions to find out more:

Please note: the following article was originally created for our current generation of Virtual Private Servers. As such, these instructions may not be relevant to our previous generation of Virtual Private Servers.

We also recommend that you make a backup of your website before proceeding.

Drupal

For details on how to integrate Memcached into Drupal, please visit the following page on Drupal’s website: Memcache API and Integration Module

Joomla

Step 1 of 4

Start by opening the configuration.php file for your website.

Step 2 of 4

Next, find the following line:
public $caching = '0';
public $cache_handler = 'file';

Step 3 of 4

Set the ‘public $caching’ value from 0 to 2 and the ‘public $cache_handler’ value from ‘file’ to memcached

You will also need to add the following lines below:

public $memcached_server_host = '127.0.0.1';
public $memcached_server_port = '11211';

Step 4 of 4

Once you’ve done this, save your file to confirm your changes.

Magento

Step 1 of 4

Start by opening the /app/etc/env.php file for your website.

Step 2 of 4

Next, find the following line:

'session' =>
array (
'save' => 'files',
),

Step 3 of 4

Change these values so that they appear as follows:

'session' =>
array (
'save' => 'memcached',
'save_path' => '127.0.0.1:11211'
),

Step 4 of 4

Once you’ve done this, save your file to confirm your changes.

To integrate Memcached into WordPress, you can install any of the following plugins:

  • W3 Total Cache Plugin
  • Batcache Plugin
  • Cachify Plugin
  • Memcached Redux

For details on how to do this, please read the following article: How do I install and activate a plugin?