Yum is a standard installation utility for CentOS 5.2. One of the reasons I favor CentOS over other Linux distros is actually because it comes with yum. It is that good!
Unfortunately, CentOS 5.2 does not generally include the latest versions of libraries, because it follows conservative path of the RedHat Enterprise. Which is not that bad of an idea, for a server OS... until you need that latest version of something and you are stuck... or: not necessarily.
If you a are a Drupal developer, there's a very good reason why you need the latest version of PHP: 5.2. The reason is called FileField module. This module is required by another absolutely essential module ImageField making it a matter of life-or-death (just kidding) to have PHP 5.2 on your server. But the latest CentOS release (ironically also 5.2) only comes with PHP 5.1.6.
What to do?
Some people on the Net suggest installing Fedora RPMs. Not such a good idea, since PHP also has a bunch of its own extensions that RPM will not like the versions of and going down that path will quickly prove being extremely painful. Also, if you install custom RPMs, you lose the benefits of Yum and that's not good at all. Compiling from source, is even worse of an idea, for all the same reasons, of course.
Like I already mentioned, yum is awesome and one of the awesome things it allows is to attach to third-party repositories. So you can still install newer versions of certain RPMs if you need to.
A third-party Yum repo simply means that somebody else went through the pain for you (thank you, Somebody!) and now you can use the benefits of their work, plus continue using yum to manage versions. Nice!
You can find some other Yum repo containing PHP 5.2 but I suggest using one from Jason Litka. He has nice, detailed explanation on his blog how to install his Yum repo: http://www.jasonlitka.com/yum-repository/ Yum recommends that you install Yum-Plugin-Priorities when you install any third-party repo.
So you start with the standard Yum installation of PHP 5.1.6 on CentOS 5.2. Then, once you have installed Jason's repo, you can update PHP. If you are using APC with PHP (always a good idea) you need to first disable it and re-install after update:
# pecl uninstall apc # mv /etc/php.d/apc.ini /tmp/apc.ini # yum update php # pecl -d memory_limit=16M install apc # mv /tmp/apc.ini /etc/php.d/apc.ini
The uninstall/re-install procedure for APC is actually relevant for any other extension you might have installed using PECL for PHP 5.1.6.
If you run into any problems uninstalling PECL just remove the .so file and the configuration that tries to load it. If you run into any problems re-installing APC with PECL, read a great blog post from Frank that explains everything in detail.