I tried compiling PHP 5.2 on CentOS but after so many tries I gave up. I was getting struck at compiling PHP with gd. And without gd it was useless. So I decided to yum and install the same.

By default if you use yum install php it will be install only php 4 series and not 5. In order to install version 5 I had to enable repo centosplus.

yum install php –enablerepo=centosplus

or

yum update php –enablerepo=centosplus

I came across another interesting repo for yum by kbsingh and after installing I was able to install a lot more. If you are interested please check out this website

http://centos.karan.org/

Have fun !! 😉