I highly suggest using the IUS Community Project repositories for upgrading your PHP 5.2, and even PHP 5.3 packages on CentOS 5. These are a set of very well maintained and high quality packages, used by Rackspace and maintained, but not supported by them (unless you're a customer of course).
The install instructions can be a little hard to find if you're new to this. You're looking for the client usage guide on their wiki. I will duplicate the instructions here for ease of use.
[root@linuxbox ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-6.ius.el5.noarch.rpm
[root@linuxbox ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-1-1.ius.el5.noarch.rpm
[root@linuxbox ~]# rpm -Uvh ius-release*.rpm epel-release*.rpm
This downloads and installs both the EPEL and IUS repos for you.
IUS promises not to use conflicting package names with any of the official repos, including EPEL (this is a great thing), things aren't as simple as
yum upgrade php. You will need to first uninstall all of your existing PHP packages, and install the appropriate ones from IUS. Alternatively, you can use the
yum-plugin-replace plugin to add a useful "replace" capability to YUM.
[root@linuxbox ~]# rpm -qa | grep php
[root@linuxbox ~]# yum erase php
rpm -qa | grep php lists each installed PHP package. You will use this list to install all the appropriate individual PHP packages from IUS
yum erase php command just erases PHP and it's dependent packages
[root@linuxbox ~]# yum search php52
[root@linuxbox ~]# yum install php52 php52-common php52-pecl-apc php52-mysql ...
yum search php52 lists the available PHP 5.2 packages
yum install installs your chosen PHP 5.2 packages. You would use the list you obtained in step one to determine which you needed
[root@linuxbox ~]# yum install yum-plugin-replace
[root@linuxbox ~]# yum replace php --replace-with php52
This will magically determine which PHP packages to erase, and which matching php52 packages to install for you.