Installing PHP 5.2.6 on CentOS 5 - extra extensions
Update 23rd May 2009 - It appears dbase, readline, json and filter were included either compiled into php or as a shared module in php-common, so I’ve removed them from the spec.
In using the installation of PHP 5.2.6 on CentOS, I noticed that there were a few modules missing from the repository that are included as part of CentOS’s extras repository. They are nowhere to be found in the testing repository.
I found an easy way to build the RPM’s by downloading both the testing php source RPM (SRPM), and the extras php-extras-5.1.6 SRPM, rewriting the php-extras spec file so it incorporated the same patches, and building it as the php-5.2.6 version.
The php-extras include the dbase, readline, mcrypt, mhash, tidy and mssql extensions. In my spec file, I have removed dbase and readline, as they have moved to php-common. I have also included the newly added extensions to php 5.2; json and filter. In future versions of CentOS, these should hopefully be updated in the extras or the base repository.
The steps that are needed:
Set up a source RPM build environment
useradd mockbuild
mkdir /usr/src/redhat
yum install rpm-build
Download and install the SRPMs, so that their build files are in the environment
wget http://mirror.centos.org/centos/5.3/extras/SRPMS/php-extras-5.1.6-15.el5...
wget http://dev.centos.org/centos/5/testing/SRPMS/php-5.2.6-2.el5s2.src.rpm
rpm -i php-extras-5.1.6-15.el5.centos.1.src.rpm
rpm -i php-5.2.6-2.el5s2.src.rpm
Save this php-extras.spec file to /usr/src/redhat/SPECS/php-extras.spec. The changes I have made reference the patches contained in the php SRPM, and have dbase and readline removed.also include the json and filter extensions to be built into RPMs as well.
Now run the build process
rpmbuild -ba /usr/src/redhat/SPECS/php-extras.spec
You will probably get an error at the start e.g.
error: Failed build dependencies:
freetds-devel is needed by php-extras-5.2.6-1.1.i386
libtidy-devel is needed by php-extras-5.2.6-1.1.i386
Install all of the packages mentioned, e.g.
yum install -y freetds-devel libtidy-devel
Now run the build process again, and by the end, you should have both an SRPM and the RPMs of the php extras.
You can put these in a repository or install them as the following:
rpm -i /usr/src/redhat/RPMS/i386/php-tidy-5.2.6-1.1.i386.rpm