Installing PHP 5.2.6 on CentOS 5 – extra extensions

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


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
yum --disablerepo=* --enablerepo=c5-testing install php-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


Update 20th June 2009 – I found a bug in PHP 5.2.6, so I have compiled 5.2.10 rpms and provided a repository from which to install them, check out the article here.
 Update 19th May 2009 – I have written an article here detailing how to build RPMs and install some additional php extensions, which although part of the PHP source distribution, is not included in this installation (extensions mcrypt, mhash, tidy, mssql)
Update 13th June 2009 – I’ve made the guide easier by using yum options to install the testing RPMs rather than using yum-priorities.
Redhat-based distributions tend to supply out of date releases of software. This isn’t technically a bad thing. They extensively test their updates before releasing out to the public, and upstream security fixes from the latest versions, meaning that they can be extremely stable when compared to some other distributions such as Debian-based Ubuntu.
However, this means that you rarely get new features added, until there is a new major release. Again this isn’t all bad, as new features add new bugs, which affect stability.
PHP 5.1.6, which is part of the base CentOS repository, was released 24-Aug-2006, almost 3 years ago. Since then, PHP 5.2 has been released, gone through 9 release builds since, and is considered stable for production environments.


There is a version of PHP (5.2.6) in CentOS’s Testing repository. You could either download each rpm and install, or set up your yum to install from the testing repository. Install the testing repository’s GPG key:
rpm --import

And download the CentOS-Testing repo file:

cd /etc/yum.repos.d

Now you can install/update to PHP 5.2.6 by running

yum --disablerepo=* --enablerepo=c5-testing update php
Explore posts in the same categories: centos

One Comment pada “Installing PHP 5.2.6 on CentOS 5 – extra extensions”

  1. My Home Page Says:

    My Home Page

    Installing PHP 5.2.6 on CentOS 5 – extra extensions | Irsukal Punya

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )


Connecting to %s

%d blogger menyukai ini: