PHP 5.1 on RHEL / CentOS 4
PHP 5.0.4, which is the most recent PHP release (current PHP release is 5.1.6) available for CentOS and RHEL 4, has a bunch of bugs that have been fixed in more recent branches. It’s also significantly slower than the 5.1 branch, and several modules like APC aren’t released for 5.0. We decided we needed to upgrade to 5.1 as quickly as possible.
Unfortunately, no one has released 5.1 for RHEL 4 / CentOS. However, there is a 5.1.2 SRPM available in Fedora Core 5. The SRPM can be built using rpmbuild after making just one small change to the spec file.
Steps to build on CentOS:
1. yum groupinstall ‘Development Tools’
2. download the Fedora Core 5 php-5.1.2 SRPM from a mirror
3. rpm -ihv (the php SRPM)
4. edit the CFLAGS= line (~line 310) of the php.spec file – remove ” -Wno-pointer-sign”
5. rpmbuild -bb ./php.spec; you’ll need to fulfill some requirements, like having Apache, MySQL and a bunch of other libraries installed
6. cd /usr/src/redhat/RPMS/-arch-/
7. rpm -ihv (the php RPMs for all of the modules you need)
That should do it. That will provide you with a PHP 5.1.2 binary on CentOS. Please note that if you need support for this binary somewhere, you won’t get it from Redhat or the CentOS team, as they purposely haven’t released a more advanced version of PHP due to stability concerns. My personal opinion is that it’s a necessary and incredibly beneficial upgrade.
As a side note, Apache 2.2 is available in much the same way (it’s worth noting that you’ll need to build PCRE, APR, and APR-Utils RPMs from FC5 source as well), and contains a similar level of improvements — such as a stable and configurable mod_cache and an optimized prefork mpm.
Edit: Here’s my php.spec file. It’s got MSSQL enabled and I didn’t put in conditionals for it because we always need it, so you’ll just need to remove any references to MSSQL or PDO-DBLIB. It requires the freetds & freetds-devel RPM from Dag’s RPM repository… don’t try to build FreeTDS .64 on your own, it won’t work.
(Note: This entry was restored from archives and the spec file is unfortunately no longer available — or applicable.)