Memcached overview


This article contains information/examples about root/sudo/admin users. These commands can only be run on a Dedicated Server with an admin user.

Memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. Many web applications (MediaWiki, Drupal, and so on) offer support for memcached.

It is only possible to install Memcached on a Dedicated Hosting plan.


Step 1 — Installing the memcached server daemon

  1. Log into your server via SSH. Make sure you log into the server using an admin user on the Dedicated Server.
  2. Run the following command to change to the root user:
    [server]$ sudo su
  3. Run the following to install the memcached daemon (server-based) package:
    root@server# apt-get install memcached
  4. After installing the memcached daemon, download a client package to access the server and extend PHP to connect to your memcached daemon.
  5. You can now type in exit to exit the 'root' user and return to the username under your site.
    root@server# exit

Step 2 — Install the libmemcache library

  1. Review the memcached installation documentation at
  2. Make sure you're in your admin user's home directory.
    [server]$ cd ~
  3. Obtain the prerequisite libmemcache at Change the version below as needed.
    [server]$ wget
    [server]$ tar -zxvf libmemcached-1.0.18.tar.gz
    [server]$ cd libmemcached-1.0.18
    [server]$ ./configure
    [server]$ make
    [server]$ make install

Step 3 — Install PECL’s memcache client

To use the PECL memcache client:

  1. Make sure you're in your admin user's home directory.
    [server]$ cd ~
  2. Download the source code and compile it. Change the version as needed.
    [server]$ wget
    [server]$ tar -zxvf memcache-2.2.7.tgz
    [server]$ cd memcache-2.2.7
  3. Compile for PHP 7.4. Change the version to the actual PHP version you need to use. View the PHP versions article for details:
    [server]$ /usr/local/php74/bin/phpize
    [server]$ ./configure --with-php-config=/usr/local/php74/bin/php-config
    [server]$ make
    [server]$ make install
    • The make install command ends with the following response:
    Installing shared extensions:     /usr/local/php74/lib/php/extensions/no-debug-non-zts-20170718/
  4. After the shared object is compiled, add it to your PHP configuration.

    For further information on adding a phprc file under the user your domain runs on, visit the following page:

  5. Add the following line to that phprc file:
    extension = “/usr/local/php74/lib/php/extensions/no-debug-non-zts-20170718/”
  6. Kill off all running PHP processes. For further information, visit the following page:
  7. Check your PHP configuration in a phpinfo.php file to confirm the extension is loading. For further information, visit the following page:
    01 memcached.png

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?