Re: PHP recompiling

From: J.O. Aho (user_at_example.net)
Date: 09/09/03


Date: Tue, 09 Sep 2003 16:56:12 +0200

Alexander Dalloz wrote:

> You should take the PHP src.rpm from RH 9. It is easy to add mcrypt
> module support to it. But compiling a newer version of PHP is not
> trivial, so be aware that you might fail.

It's not that difficult to compile a new version with help of an older source
rpm, then only problem will be the patches, some of them aren't needed anymore.

First, "install" the source package:
rpm -ivh php-x.y.z-q.src.rpm

CD to the directory with spec files:
cd /usr/src/redhat/SPECS

Now you need to edit the spec file, it's not that much you really need to do,
first you need to update the version number:

Version: 4.3.1

When you done that, you scroll futher down and you find the line starting with
'./configure' and the rows beneath it are part of the configure line too, as
'\' tells that continues on next line.
Here you add the option for compile the mcrypt (for the option name, do a
./configure --help).

Save your php.spec and copy the new tarball of php to /usr/src/redhat/SOURCE.

What's left now, is to know which patches to include or not. As I'm quite
lazy, I start to build the new RPM, it will notify me if a patch can't be
applied, then break the RPM (ctrl-c) and comment the line in the php.spec file
that applies the patch.

#%patch3 -p1

And then build the RPM again, repeat the previous step untill all patches that
are uncommented are applied to the source.

And hopefully you have all the requiered devel packages installed, and the RPM
will be built and all the RPMs are then found in /usr/src/redhat/RPMS/i386.

To build a RPM: rpmbuild -ba /usr/src/redhat/SPECS/php.spec

Don't forget, after the RPMs are built, you need to install them (don't
install the sourcerpm that is built too).

  //Aho