How to upgrade php 5.1 to 5.2

CentOS – Upgrade PHP 5.1 To 5.2

Today I was encountered with one problem,I have successfully install LAMP server on my CentOS 5 box,but when I installed drupal 7.0 on it,it throws an error like the minimum requirement to install the drupal 7.0 is php should be at least 5.2.4 .
These instructions were created using CentOS 5.3 32-bit server :-
First check which version of php you have installed:-

Add the new repositories:-

First thing we need to do is add the new repositories to yum. When we add the this repository to configure it so it only pulls PHP packages. To start we’ll need create a new yum repository configuration file :

Copy/paste the following into this file:



Make sure that there is no spaces at the start of each line, then save and close the file.
Update PHP packages :-
Now you can use yum to update the PHP packages on your system:

You should be shown a list of new packages that are going to be updated. Compare it to the list of your previously installed PHP packages . Note any packages that are not in the list. You’ll need to remove these packages or find updates for them because they won’t work after you update to PHP 5.2.x. If that is acceptable type “y” to continue and let yum update the packages.
Once yum has completed restart Apache:

To verify the update is working create a simple phpinfo.php in your documentroot or www directory with the following source code:

and open it in a web browser. The new PHP version should be reflected at the top of the page.
You should now have PHP 5.2.10 running on CentOS 5.3 32-bit.

Enjoy Linux…!!!

Leave a Reply