This is my preferred way to upgrade PHP to 5.2 from the default 5.1.6 on CentOS 5.

You need to be root.

1) Make a reference to the CentOS5 Testing repo

Create the file /etc/yum.repos.d/centos-test.repo and put the following lines in it.

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


2) Update php using yum as follows

yum --enablerepo=c5-testing update php