Howto upgrade PHP 5.1 to 5.2

How to upgrade PHP 5.1 to 5.2 on CentOS 5.x. The need to upgrade your php version passed the stable repositories provided by CentOS varys and luckly CentOS provides a Testing Repo for doing this.

Enabling CentOS Testing Repo

Edit with nano or vi
/etc/yum.repos.d/CentOS-Testing.repo

and copy and paste the following

# CentOS-Testing:
# !!!! CAUTION !!!!
# This repository is a proving grounds for packages on their way to CentOSPlus and CentOS Extras.
# They may or may not replace core CentOS packages, and are not guaranteed to function properly.
# These packages build and install, but are waiting for feedback from testers as to
# functionality and stability. Packages in this repository will come and go during the
# development period, so it should not be left enabled or used on production systems without due
# consideration.
[c5-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*

From here all that is needed is to simply check what PHP packages you currently have and then upgrading them.

Checking current packages


rpm -qa |grep php

Upgrading PHP

yum update

Restart apache to allow it to see the new version of PHP

service httpd restart

Check the new versions of PHP

rpm -qa |grep php

For futher notes about the upgrade see CentOS’s Wiki below.

Ref: http://wiki.centos.org/HowTos/PHP_5.1_To_5.2

Leave a Reply