Binary RPM are available in the Enterprise Linux 5 x86_64 dedicated repository.

As I don't plan to publish this RPM for other version / arch, you will have to build them by yourself. However this is a quite simple task, mainly because the source RPM available in my repository are designed for this.

In this guide, I use the rpmbuild command, more experienced users should prefer the use of mock.

1. Set then building environment

Under the root account:

useradd phpbuilder
yum install rpm-build rpmdevtools

Under the phpbuilder account:

rpmdev-setuptree

2. Get the sources

Download from my repository the latest version of the source packages. For now, packages designed to be relocated are

I also plan to adapt other pecl extensions, as new versions are published by upstream.

I don't plan to apdapt pear extensions (too large collection) so you will have to use the "pear install" command.

3. Install the dependencies

Under the root account:

yum-builddep /home/phpbuilder/php-5.3.4-3.remi.src.rpm

4. Build PHP

Under the phpbuilder account:

rpm -ivh php-5.3.4-3.remi.src.rpm
rpmbuild -bb --define "rhel 5" --define "phpname php53" rpmbuild/SPECS/php.spec

It's the phpname macro value which handle the relocation.

Other packages could then be build following the same process.

5. Installer

Build RPM are available in the /home/phpbuilder/rpmbuild/RPMS/<arch> directory

They are named php53-*

6. Use

You just need to add the path of the command to select to used version.

$ php -v
PHP 5.1.6 (cli) (built: Nov 13 2010 16:05:12)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
$ /usr/bin/php53/php -v
PHP 5.3.4 (cli) (built: Dec 27 2010 16:38:32)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Configuration files are located in the /etc/php53 directory.

Notice : it is not possible to load both the apache modules. So you will have to use one of the apache module, for the most used applications, and the cgi module for the others. Another solution is to run two apache instances.

7. Conclusion

Generated RPM are still under qualification. It could be slightly modified, according to test results.

Of course, it will be possible to remove this RPM to definitively switch to version 5.3.4, using RPM available in my repository.

This guide also apply for Enterprise Linux 4, and should apply for Fedora <= 11 (which provides php 5.2).

Thanks to Compass Network which have made this work possible.

Your feedback are welcome.