To test things on our RHEL 5 production servers, I fire up CentOS 5 in VMWare.  While we build PHP 5.2 manually in production, I try to avoid doing so just for testing. Unfortunately, CentOS 5 is packaged with PHP 5.1 by default which becomes a big difference between my testing and production environments.  Fortunately, there is a CentOS yum repository out there with PHP 5.2.  I thought I’d document this here for anyone else with the same problem.

The solution I found starts with this thread about upgrading PHP on the CentOS forums.  To summarize, run these commands:

% cd /etc/yum.repos.d
% wget

Then, edit the .repo file and set the "enabled" value to "1".

% yum list available php
Available Packages
php.i386                                 5.2.6-2.el5s2          c5-testing