Iworx php5 srpm


I’d like to change this spec file to install php5 in an other location than /usr (the value of my _prefix variable) and /etc (the syscoonfdir variable)

In fact, as you did the Spec file could you please tell me what could be the best way :

  • 1 -
    Create a specific ~/.rpmmacros files and change all needs rep to what I want (for example prefix /usr/local/php5, sysconfdir /etc/php5, …)

then simply recreate the RPM and isntall it

So in this case php5 will be installed in a specific dir

  • 2 -
    Find a way to change the bin php in php5 (to have /usr/bin/php5). and every others files that could corrupt our existing php4 installation, like /etc/php5.ini rather php.ini, etc…

Which solution should be the easiest one from your SPEC file ?

(I personnaly thing create a tmp ~/.rpmmacros to change the variables prefix, sysconfdir, bindir, etc… or maybe just change these kinds of things in the SPEC file directly fdor the ./configure)

I also see that you’ve done a double Make Install one for the CGI and one for the DSO
Could I also add one for CLI (by creating a 3rd dir in buildroot and perform the same pushd than you do and perform a make install-cli)

Any directions/advises you could give me of how I could change your sprm to have PHP5 installed on a box with an existing PHP4

If it is not a good solution I’ll just install php5 manually but I’d really prefer RPMs

Thanks for your directions or advises


Overriding the prefix/sysconfdir etc from a .rpmmacros file is probably the easiest Pascal. I’d double check the SPEC to make sure that we don’t use any hard coded /etc or /usr references (although I tried hard not to :))


Thank you Chris.

I didn’t do it because there is the etc…

haha I’m not really sure about some of variable like localstatedir libdir etc… I really afraid to override some php4 install.

I have looked at your spec file and I think I will alos comment all the make install for the dso and all staff about the dso (httpd.conf etc…) Just in case.

Lol saying that and everybody will find most easiest to simply install php5 manually :slight_smile:

I’ll see and if I do a new php rpm that could be isntall concurrently with a php4 installation I’ll give here the rpm



Well I’m currently being update the spec file.

I didn’t choose the .macro overrides because I think some iworx users might be interested by this rpm and I don’t want they have to create a special config file before installing the rpm.

I first thought was to just modify some default dir in the ./configure and especially these ones :

    --localstatedir=%{_localstatedir}/php5                \
    --libdir=%{_libdir}/php5                              \
    --includedir=%{_includedir}/php5                      \
    --sysconfdir=%{_sysconfdir}/php5                      \
    --with-config-file-path=%{_sysconfdir}/php5           \
    --with-config-file-scan-dir=%{_sysconfdir}/php5/php.d \

then just copy all bin from sapi to /usr/bin with php5-xxx and symlink php5-cgi to php5. I thought perform this as you do it with the pushd cgi-bin dir

It should be ok but I didn’t see that there were also the installation of the php-devel package which one also install some binaries in default %_bindir like :

%files devel

So if I let in the configure the default %{_bindir} the php-devel binaries might overrides those of php4.

So I think to change the %{_prefix} and %{_bindir} to /usr/local/php5 and /usr/local/php5/bin. Of course if I do this I’ll have to change the php-xx binaries’ copy process to something like this

pushd build-cgi
cp -f sapi/cli/php %{buildroot}/usr/local/php5/bin/php5-cli
cp -f sapi/cgi/php %{buildroot}/usr/local/php5/bin/php5-cgi
#rm -f %{buildroot}%{_bindir}/php
pushd %{buildroot}%{_bindir}
ln -fs %{buildroot}/usr/local/php5/bin/php5-cgi php5
ln -fs %{buildroot}/usr/local/php5/bin/php5-cli php5-cli
ln -fs %{buildroot}/usr/local/php5/bin/php5-cgi php5-cgi

With this solution all bins including those of php5-devel will be in /usr/local/php5/bin (i also change the %files to reflet this.

But now I’m not convince it is the best way. Maybe I could let the default %{_prefix} and %{_bindir} and in the %install just do a move of the php5-devel binaries from :

%{buildroot}%{_bindir}/php-config to %{buildroot}%{_bindir}/php5-config
%{buildroot}%{_bindir}/phpize to %{buildroot}%{_bindir}/php5ize

and change the %files to reflect this.

But I’m not sure it is a good way as maybe some scripts use by default phpize and not php5ize.

So do you think the best solution would be to define a new prefix and bindir as I first thought ?

I hope you understand what I mean, it is not so easy to explain this.

Also I didn’t find the Source3 file (php.conf) in the tarball. I’d like to modify it by php5.conf and change it contents to have a php5 cgi config in httpd.

For the /usr/local/php5 solution here is what I’ve done
Main changes are in the %build section and after.
see attached file.

I have commented all dso install.


php5-spec-build-andafter.txt (12.3 KB)