The following is a build log for installing PHP 5.2.5 on Red Hat Enterprise 5 / CentOS 5. I grabbed the source RPM from Fedora 9. Some people just have to have the latest version. Sigh.
I highly recommend this build method if you require PHP 5.2. It folds in all the latest Fedora patches, which will eventually make their way into Enterprise.
Please note that you can tweak the configure options by editing the php.spec before executing rpmbuild.
I happen to be building on x86_64 64-bit, but this will most likely work on 32-bit as well. Some of the build dependencies require packages from EPEL.
# cd /usr/src
# wget http://fedora.osuosl.org/linux/releases/9/Everything/source/SRPMS/php-5.2.5-7.fc9.src.rpm
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
# yum install httpd-devel libc-client-devel postgresql-devel \
unixODBC-devel net-snmp-devel gd-devel libmcrypt-devel \
mhash-devel libtidy-devel freetds-devel aspell-devel
# yum install apr-devel
# rpm -ihv php-5.2.5-7.fc9.src.rpm
# cd /usr/src/redhat/SPECS
# rpmbuild -bb php.spec
# cd /usr/src/redhat/RPMS/x86_64
# rpm -ihv php-5.2.5-7.x86_64.rpm php-ldap-5.2.5-7.x86_64.rpm \
php-gd-5.2.5-7.x86_64.rpm php-cli-5.2.5-7.x86_64.rpm \
php-common-5.2.5-7.x86_64.rpm php-mbstring-5.2.5-7.x86_64.rpm \