Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.

Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages.
To install memcached type this command

$ apt-get install php5-memcache

The php5-memcache package installs everything correctly and adds a memcache.ini file to the path: /etc/php5/conf.d/
which is where all the individual php extension packages put their ini files to be read. If you look at that file you will find that the line: extension=memcache.so is commented out with a semicolon preceding it. If you uncomment that line then memcache becomes available and you can manipulate the other settings in the file as necessary.
e.g. extension=memcache.so

To find out your php.ini location, execute following command:

$ php -i | grep php.ini

Configuration File (php.ini) Path => /usr/local/lib or /etc/php5/conf.d/

And finally restart Apache so that it will pick up the new extension:

/etc/init.d/apache2 restart


/etc/init.d/httpd restart

Running phpinfo() on your webserver should now confirm that memcache is installed.

To check the running status of memcached

$ netstat -anp | grep 11211

tcp  0  0 :::11211    :::*  LISTEN      6475/memcached
udp 0  0* 6475/memcached

To check is memcache extension loaded in php, execute following command.

$ php -i | grep memcache

memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 8192 => 8192
memcache.default_port => 11211 => 11211
memcache.default_timeout_ms => 1000 => 1000
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => standard => standard
memcache.max_failover_attempts => 20 => 20
Registered save handlers => files user sqlite memcache
PWD => /usr/src/memcache-2.2.5
_SERVER[“PWD”] => /usr/src/memcache-2.2.5
_ENV[“PWD”] => /usr/src/memcache-2.2.5

This information can also be seen using phpinfo().