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:

yum install php

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!

  3 Responses to “PHP 5.3.5 on Red Hat/CentOS 5”

  1. Greg,
    I recently made a request to my Linux Admin to upgrade PHP on a CentOS system. The ‘excuse’ he gave me for the reason why he could not do it was that he couldn’t update it from within the CentOS Operating System.

    Would this RPM from your repository be able to do it automatically AND keep the CentOS updated?
    -C

  2. That’s correct. The idea behind putting it in a repository in the first place was so that I’d be able to use yum to do installs (and updates if I put any out there) of the packages in the TLF repository.

  3. [...] at The Linux Fix we have a talented bloke named Greg who has worked on this problem in the past when he created a yum repo for PHP 5.3.5 for use with CentOS.  Well, what’s changed since [...]

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

 
© 2012 TechRockDo Suffusion theme by Sayontan Sinha