Pages

Sunday, June 17, 2012

Upgrade PHP 5.1 to PHP 5.2


Here I will show you that, how to upgrade the standard PHP 5.1.x packages in CentOS 5.x 32-bit to the current development versions 5.2.x.
# rpm -qa |grep php
php-cli-5.1.6-27.el5_5.3
php-pdo-5.1.6-27.el5_5.3
php-5.1.6-27.el5_5.3
php-common-5.1.6-27.el5_5.3
php-mysql-5.1.6-27.el5_5.3
As long as you’re using the standard PHP packages on your CentOS server you won’t need to do anything extra. If you’re using extra PHP packages that aren’t part of the standard CentOS repositories (like php-mcrypt) you’ll have to remove them or find updated versions of them.
Now, add the development repository – CentOS-Testing.repo
# vim /etc/yum.repos.d/CentOS-Testing.repo
Copy/paste the following into this file:
[CentOS-testing]
name=CentOS-5 Testing
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
includepkgs=php*
Now you can use yum to update the PHP packages on your system:
# yum update
Once yum has completed restart Apache:
# service httpd restart
To verify the update is working create a simple testphp.php in your www directory with the following source code:

  phpinfo();
?>
and open it in a web browser. The new PHP version should be reflected at the top of the page.
Or
# php -v
PHP 5.2.10 (cli) (built: Nov 13 2009 11:24:03)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

No comments:

Post a Comment