How to Install Memcached on Debian / Ubuntu

Memcached is free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

First of all, install memcached dan php5-memcached packages:

$ sudo apt-get install memcached php5-memcached

and then make sure memcached is running with this command:

$ netstat -anp | grep 11211
 tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      20518/memcached
 udp        0      0 127.0.0.1:11211         0.0.0.0:*                           20518/memcached

Restart apache web server:

$ sudo /etc/init.d/apache2 restart

Check php5-memcached module using phpinfo.php:

$ nano /var/www/phpinfo.php

Write below code:

<?php
phpinfo();
?>

Open browser and go to http://ip_address_server/phpinfo.php and search for memcached line.

memcached installation on Debian / Ubuntu is finished.

Leave a Reply

Your email address will not be published. Required fields are marked *