Friday, October 30, 2009

Installing php 5.2.9

In CentOS, if you do

php --version

you will get it as 5.1.x

But if you are planing to use zend search lucene (http://www.zend.com/community/downloads and look for Zend Framework 1.9 minimal) or any of other zend packages, system requirements shows you need 5.2.4 or higher.

So how to upgrade php to 5.2.9 in centos 5?

Best Method:

http://www.freshblurbs.com/install-php-5-2-centos-5-2-using-yum#comment-403

The solution presented by "Great" on the above link is the perfect one.

This is what he says,

All, we need to do is create /etc/yum.repos.d/CentOS-test.repo and enter following lines in it:

[c5-testing]
name=CentOS-5 Testing 
baseurl=http://dev.centos.org/centos/5/testing/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing

Once done, just type

yum upgrade php

and you are good to go. Upon completion, the php is upgraded to 5.2.9

Others methods are:

(1)
One way to do so is http://www.atomicorp.com/wiki/index.php/PHP using yum.

But it did not work out for me, so I tried,

(2)
# wget ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz
# tar xzvf libxml2-2.7.3.tar.gz
# cd libxml2-2.7.3
# ./configure
# make
# su -c “make install”


# wget http://uk2.php.net/get/php-5.2.9.tar.gz/from/uk.php.net/mirror
# tar zxvf php-5.2.9.tar.gz
# cd php-5.2.9
# ./configure –enable-soap
# make
# su -c “make install”


I took this solution from, http://imthi.com/blog/linux/install-or-update-php-5-on-centos.php#comment-28316 given by Brent.

It worked for me. after doing the above steps, when I did,

php --version

on command prompt. It should show, 5.2.9. But on apache, doing phpinfo() it showed 5.1.6 So the answer lies in PHPIniDir line in httpd.conf. Just need to add PHPIniDir "path/to/php" in httpd.conf.

Restart apache and system and enjoy !

No comments:

Post a Comment