How To Install memcached with PHP Extension on CentOS

How To Install memcached with memcache PHP Extension on CentOS 5.x

yum install libevent

yum --enablerepo=rpmforge,rpmforge-extras install memcached


Try installing zlib-devel.

http://www.sohailriaz.com/how-to-install-memcached-with-memcache-php-extension-on-centos-5x/


1) Install memcached.

Enable rpmforge respository to install latest memcached rpm using yum.
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Use yum to install memcached

yum -y install memcached

As soon as memcached installation completed, edit options for memcached in /etc/sysconfig/memcached to meet your need.

vi /etc/sysconfig/memcached

Save the file. All options can be seen by using following command

memcached -h

Start memcached

/etc/init.d/memcached start

to check the running status of memcached

/etc/init.d/memcached status

and

netstat -anp | grep 11211

2) Install PHP Extension.

Download and install latest stable memcache version from PECL.

cd /usr/src
wget http://pecl.php.net/get/memcache-2.2.5.tgz
tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5
phpize
./configure
make
make install

memcache.so will be install in php modules directory, now enable memcache.so extension in php.ini

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

php -i | grep php.ini

vi /usr/local/lib/php.ini

extension = “memcache.so”

save the file and restart httpd server.

/etc/init.d/httpd restart

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

php -i | grep memcache