Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to set up Memcached for your website

This guide explains what Memcached is and how to turn it on so your site loads faster. Server steps need root access.

cPanel2 min read13 steps4 screenshots

What is Memcached?

Memcached is a fast memory store. It keeps bits of data in the server's memory, called RAM. RAM is much faster than a hard disk. A site can ask Memcached for a ready answer. It does not need to ask the database again. A database is where a site keeps its information. It is like keeping your most used books on your desk, not in the library.

Memcached helps most on busy sites, such as WordPress, Magento or forums. Ask Hostvento support whether it is available on your plan. On shared hosting, you may not be able to install it yourself.

Part 1: Install on a server (root access)

Take a backup first.

  1. Log in over SSH as root.
  2. Install the Memcached service.
    yum install -y memcached
    Use dnf on newer systems.
  3. Start it and make it start at boot.
    systemctl enable --now memcached
  4. Check it runs.
    systemctl status memcached
    Look for the word active.
  5. Keep it private. Edit /etc/sysconfig/memcached and make sure it listens only on 127.0.0.1. Open internet access to it is a risk.
    OPTIONS="-l 127.0.0.1"
    LMSCD User Manager
  6. Restart it with systemctl restart memcached.
    Change Password button

Part 2: Add the PHP extension

PHP needs an add-on to talk to Memcached.

  1. On cPanel, log in to cPanel and open Select PHP Version, then Extensions. Tick memcached, or memcache. Save.
  2. On a server with WHM, install the package for your PHP version in the EasyApache area, or with a command such as dnf install ea-php81-php-memcached.

Part 3: Connect your site

For WordPress:

  1. Install a caching plugin that supports Memcached. In the WordPress dashboard, go to Plugins then Add New.
    LiteSpeed cache plugin
  2. Open the plugin's settings.
  3. Choose Memcached as the cache method.
    username password
  4. Type 127.0.0.1:11211 as the server. Port 11211 is the usual Memcached port.
  5. Save, then test your site.

For other apps, look in their cache settings for a Memcached option.

Check it works

  • Run php -m | grep memcache. It shows the extension if it is on.
  • Reload your site a few times. It should feel quicker.
Tip: Memcached forgets everything when it restarts. That is normal. It fills again as visitors browse.

Quick recap

  • Memcached keeps ready answers in RAM to speed up your site.
  • Install it, start it, and keep it on 127.0.0.1.
  • Turn on the PHP extension.
  • Set your app or plugin to use it.