I’m a big fan of Red Hat Enterprise Linux as a server OS. For hosts that don’t require high service level agreements, all of the RHEL-based community distributions like CentOS and Scientific Linux are a perfect choice in my opinion. One of the drawbacks of using these is that as a trade-off for support, reliability, and you don’t always get the latest and greatest versions of software or applications. That being the case, when I recently found a need to install php 5.3.5 on some CentOS-based hosts, I was a bit put out.
I could download the source and build it from scratch, but why not do something re-usable? I decided to make an rpm in order to distribute it to any other servers I needed to. I had an installation of RHEL 6 that I had been playing with, so using the source rpm for the php-5.3.1 rpm distributed with RHEL 6, I had my starting point to build a RHEL 5 rpm. The end result is that I have published some php-5.3.5 rpm’s in the yum repo hosted at The Linux Fix.
In order to use it, just run the following as root:
rpm -Uvh http://www.thelinuxfix.com/yum/RHEL/5/`uname -i`/tlf-release-1-1.noarch.rpm
This will set up the yum repository configuration file and copy the gpg public key to /etc/pki/rpm-gpg on your system. From there, you should be able to just do:
as root. This will download and install (or update) php on your system to version 5.3.5.
There are two things to note; first if you need other php modules, you’ll need to install those separately (for example, yum install php-mysql if you need mysql support), which is pretty standard for any RHEL-based distribution. The second thing is that if you install the php-sqlite or php-pdo modules, one of the dependencies is sqlite version 3.6, which is also in the tlf repo. The important thing to note is that sqlite is used by some pretty core components of RHEL (rpm, to be precise), and upgrading this on a supported system may complicate any support you try to get from Red Hat in the future. While all of my testing has been successful and I have not run into any problems, if you upgrade sqlite, you do so at your own risk!