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.
wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz tar -vxzf memcached-1.4.15.tar.gz ./configure 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 http://www.monkey.org/~provos/libevent/ 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.