ABHIONLINUX
Site useful for linux administration and web hosting

2011/06/27

how to install memcached on centos

You can use the command given below to find the centos version.

# cat /etc/redhat-release


Dependency that is needed for memcached is libevent. First we will proceed with  libevent.
Steps for installation libevent.
 # cd /usr/local/src/
 # curl -O http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
 # tar xzvf libevent-1.4.14b-stable.tar.gz 
 # cd libevent-1.4.14b-stable
 # ./configure --prefix=/usr/local/
 # make 
 # make  install

Next we need to  install memcached.
# cd /usr/local/src
# curl -O http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
# tar -xvzf memcached-1.4.5.tar.gz
# cd memcached-1.4.5
# LDFLAGS='-Wl,--rpath /usr/local/lib' ./configure --prefix=/usr/local
# make
# make install

You can verify the memcache using the command
# memcached -u root -d
If there are no errors, memcache is successfully installed and is running.
# ps aux | grep memcached

Note: 
memcached: error while loading shared libraries: libevent-1.4.so.2: 
  cannot open shared object file: No such file or directory
  configure: error: libevent is required
  If it's already installed, specify its path using --with-libevent=/dir/


Install php-memcache

Please try the following steps
wget http://pecl.php.net/get/memcache-3.0.3.tgz
# tar -xvzf memcache-3.0.3.tgz
# cd memcache-3.0.3
# phpize
#./configure
# make
# make install

Open php.ini
# vi /etc/php.ini
add the line given below.
extension=memcache.so


Then restart apache. You can check this my "php -m | grep memcache"


No comments:

Post a Comment