How to Install Memcached on CentOS Linux


What is Memcached?
An open source high-performance distributed memory object caching system.

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.

How to install Memcached?
Below is a guide on how to install memcached on your server.

Download the memcached package.

tar -vxzf memcached-1.4.15.tar.gz

checking for gcov... /usr/bin/gcov
checking for main in -lgcov... yes
checking for library containing clock_gettime... -lrt
checking for library containing socket... none required
checking for library containing gethostbyname... none required
checking for libevent directory... configure: error: libevent is required.  You can get it from

      If it's already installed, specify its path using --with-libevent=/dir/

If the system is not able to find the libevent and libevent libraries during the configuration time then you need to install both libevent and libevent-devel packages.

yum -y install libevent libevent-devel

Once memcached is installed, you need to install a memcache client to be able to access the memcached server.

pecl install memcache

Run your memcached server.

 /usr/bin/memcached -u nobody -d

After memcache client library is compiled, you need to tell your php interpreter where to find it and use it as extension.

Now restart your web server and check your php information output. You should see the memcached module installed and enabled.

To test if your memcached server is working, check out the url below for code examples.

If you find this site helpful please consider donating


Batman has written 226 articles

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">