Improve the performance of your dynamic website with Memcached Cache on AWS Lightsail

In this video tutorial I will show you how to install and configure Memcached module. Similar to Redis, which I did a tutorial in my last video, is an object level caching mechanism that will cache your websites database queries in memory. Enabling this will prevent your application from hitting the database for the same requests and as a result will speed up dynamic websites. This is different from CDN services and
I explain the difference between CDN and Object/Dynamic caching in my previous video so check that out if you’re interested in understanding the differences. So without further ado lets’ check Memcached.

keep in mind I am using Bitnami WordPress blueprint in AWS lightsail for this tutorial. If you have a different setup of LAMP/Wordpress, some of these commands will be slightly different. I will try to link to some documentation that may help you in case your setup is different.

Also for these steps you will need your own VM or full access to your server instance via SSH. If you have shared hosting this is not for you; however your hosting provider may already have all these configurations done for you so you might just have to perform the WordPress steps. Check with your hosting provider. If they don’t have this and are not willing to enable it for you then its’ time to switch hosting providers. AWS Lightsail is great platform to migrate to from a shared hosting environment.



  1. If setting up new server:
    1. sudo apt update -y
    2. sudo apt upgrade -y
  2. Install Memcached on bitnami blueprint
    1. apt install memcached
    2. sudo service memcached start
  3. Install PHP memcached extension
    1. sudo pecl install memcached
  4. Enable the extension in PHP.ini
    1. sudo vi /opt/bitnami/php/etc/php.ini
    2. uncomment (remove semicolon) on line ;
  5. Restart (bitnami blueprint)
    1. sudo /opt/bitnami/ restart
  6. Check if memcached is enabled
    1. php -i | grep "memcached support"
  7. Modify wp-config.php
    1. Add line define('WP_CACHE',true);
  8. Install and Activate W3 Total Cache Plugin
  9. Configure Plugin to use Memcached


memcached – a distributed memory object caching system

How To Install Memcached on Ubuntu Server And Configure WordPress (

All videos tutorials on the website as well as the YouTube channel aim to provide a simplified process for a specific scenario; there could be many different factors and unique use cases you may have. The tutorials may not cover every situation; so treat is as a starting point or learning concept to apply to your unique situations, and consider this inspiration but not prescription or explicit direction.

Scroll to Top