rss feed Twitter Page Facebook Page Github Page Stack Over Flow Page

How to install MemCached in Ubuntu

Consider using Docker instead!

What is MemCached?

"MemCached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load."

Basically, it means it save and retrieve data in the server memory. This is typically used to remove the loads on the database server.

The logic of MemCached is very simple:

run the following command to install memcached:

sudo aptitude install memcached

If you want to change the default settings, simply create the file and update the configuration.

First, create memcached configuration file:

vi /etc/memcached.conf

Then, change the settings:

# Memory a usage in Mb
-m 16
# default port
-p 11211
# user to run daemon nobody/apache/www-data or else
-u nobody
# only listen locally

Save and quit the file. Once this is complete, don't forget to restart the daemon:

sudo /etc/init.d/memcached restart

Now lets install for php

sudo aptitude install php5-memcached

Restart both services:

sudo /etc/init.d/memcached restart ; sudo /etc/init.d/apache2 restart

If you would like additional information about MemCached please visit: