When Centos came out with php53* packages, I promptly upgraded to test them out. I did not get around to installing PECL and memcache until recently, and soon realized they were no longer available. This article shows how I was able to install PECL and memcache on a Centos (5.6) system using the IUS repository.
Since I am running the php53* packages, the provided php-pecl-memcache package is not compatible. Checking what PECL packages are available:
$ yum list | grep -i ^php.*pecl
php-pecl-Fileinfo.x86_64 1.0.4-3.el5.centos extras
php-pecl-fileinfo.x86_64 1.0.4-2.el5.rf rpmforge
php-pecl-http.x86_64 1.6.5-2.el5.rf rpmforge
php-pecl-mailparse.x86_64 2.1.5-2.el5.rf rpmforge
php-pecl-memcache.x86_64 2.2.5-2.el5.rf rpmforge
php-pecl-session_mysql.x86_64 1.9-2.el5.rf rpmforge
php-pecl-ssh2.x86_64 0.11.0-1.el5.rf rpmforge
php-pecl-zip.x86_64 1.8.10-2.el5.rf rpmforge
I decided to try out the IUS repository which provides a new set of php53 packages, along with pecl and memcache.
The IUS packages are also not compatible with the installed php53* packages, so I removed them and installed the new php53u* packages.
# checking which are currently installed
$ yum list | grep -i ^php.*installed
php53.x86_64 5.3.3-1.el5_6.1 installed
php53-cli.x86_64 5.3.3-1.el5_6.1 installed
php53-common.x86_64 5.3.3-1.el5_6.1 installed
php53-devel.x86_64 5.3.3-1.el5_6.1 installed
php53-gd.x86_64 5.3.3-1.el5_6.1 installed
php53-mbstring.x86_64 5.3.3-1.el5_6.1 installed
php53-mysql.x86_64 5.3.3-1.el5_6.1 installed
php53-pdo.x86_64 5.3.3-1.el5_6.1 installed
# removing existing:
$ yum remove php53*
# installing IUS packages:
$ yum install php53u php53u-cli php53u-common php53u-devel php53u-gd php53u-mbstring php53u-mysql php53u-pdo php53u-pear php53u-pecl-apc php53u-xml php53u-xmlrpc php53u-pecl-memcache
Next, I installed the memcached service.
# install
$ yum install memcached
# set run levels
$ chkconfig --level 2345 memcached on
# start service
$ /etc/init.d/memcached start
After installation, I restarted Apache and checked to ensure memcache was not working.
$ php -i | grep -i memcache\ support
memcache support => enabled
I created a tiny script to test for memcache support:
<?php
$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211);
print_r($memcache);
?>
$ php memcachetest.php
Memcache Object
(
[connection] => Resource id #4
)
Now, my system is ready to begin work with the Memcache API and Integration Drupal module :)