How to Install Memcached on Debian

Share Now

1. Login to your VPS

2.Step 1 – Install Memcached on Debian

sudo apt update
sudo apt install memcached

3. Step 2 – Memcached Configuration
For initial level configuration check for the following settings under Memcache configuration file /etc/memcached.conf.

-d => Run Memcached in deamon mode.
-m => Maximum memory to be used by Memcached. (default: 64 MB)
-p => Define port for Memcached. (default: 11211)
-l => Define IP address to listen on. Use 0.0.0.0 to listen on all IPs(interfaces).

Step 3 – Test Memcached Setup [This step is skippable]

echo "stats" | nc localhost 11211

Step 4 – Install Memcached PHP Extension

sudo apt install php-memcached

Step 5 – Restart Apache

phpenmod memcached
sudo service apache2 restart

All done, You can now test Memcache PHP extension is enabled and working properly by creating an info.php file using the following code.

<?php
  phpinfo();
?>

*** Main Article:
How to Install Memcached on Debian

Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert