Install memcached daemon / Install memcached extension using pecl

→ Are you a new visitor? Please visit the page guidance for new visitors ←

A little about Memcached

Memcached is a service that allows you to store in memory key-value data like strings or objects, from results like databases queries, API calls and drastically accelerating queries and reducing the load on your server. Memcached is being used by major websites like Youtube, Twitter, Digg, and many many more. In this artile we’re going to see how we can install Memcached on a server running CentOS.

To install Memcached, there are a few steps that you need to do, see bellow:

Installing Memcached (Daemon)

First we need some packages installed for Memcached to work on our server.

We download the latest (currently 1.4.10) version of memcached and untar it to our server:

Then we start configuring memcached, compile it and install it.

Preparing system to run with Memcached on startup.

And finanly we will start memcached daemon

PECL Memcache Module Installation:

Next step is to install the php module for using memcached directly from php. We can do this easily using PECL.

Next in the folder /etc/php.d/ we create a file memcache.ini in which file we add the bellow content:

And next we restart the web server.

That is all, it should look similar like in the image bellow:

Memcache phpinfo page

Memcache phpinfo page

Request an article ←