PHP4Although I was initially struggeling, I finally managed to build a PHP4 RPM for CentOS 5 :)

Initially I planned to make tutorial on how I managed to build my RPM (which you can still use), however due to some issues with the original PHP 4.3.9 RPM for CentOS 4 I decided to create a RPM of PHP 4.4.7 (and upgrade to 4.4.8 later).

A few challenges later I managed to cleanly build PHP4 including passing all the needed tests.

UPDATE: See this new post for a slightly new version and eAccelerator RPM’s.

I’m not going to explain all the challenges I had to overcome to get the RPM’s to build, in stead you can just grab the SRPM yourself and build the RPM’s. I will supply the fully build RPM’s soon.

Changelog since 4.3.9-3.22.9.el4

[CaliMonk@DYV001 ~]$ less ~/build/redhat/SRPMS/php4-4.4.8-LAB3.src.rpm
Name : php4 Relocations: (not relocatable)
Version : 4.4.8 Vendor: (none)
Release : LAB3 Build Date: Sat 05 Jan 2008 06:25:36 PM CET
Install Date: (not installed) Build Host: DYV001
Group : Development/Languages Source RPM: (none)
Size : 5930077 License: The PHP License
Signature : (none)
URL : http://www.php.net/
Summary : The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)
Description :
PHP is an HTML-embedded scripting language. PHP attempts to make it
easy for developers to write dynamically generated webpages. PHP also
offers built-in database integration for several commercial and
non-commercial database management systems, so writing a
database-enabled webpage with PHP is fairly simple. The most common
use of PHP coding is probably as a replacement for CGI scripts. The
mod_php module enables the Apache Web server to understand and process
the embedded PHP language in Web pages.

Changelog

* Sat Jan 05 2008 Ivo Teel <calimonk@gmail.com> 4.4.8_LAB3
- Patched php.ini, so the extention dir is /usr/lib/php4
- Renabled checks
- PHP4 gives errors when using the magic.mime, supplied by
file-4.17. The magic.mime file used by rpm-build 4.4.2
is valid (Similar to http://bugs.php.net/bug.php?id=36915).
- Patched pspell test to include new spellings.
- Unpack test removed, actual test did succeed. Bug in PHP 4.4.8
(http://bugs.php.net/bug.php?id=43751)

* Sat Jan 05 2008 Ivo Teel <calimonk@gmail.com> 4.4.8_LAB2
- Fixed libdir to /usr/lib/php4

* Sat Jan 05 2008 Ivo Teel <calimonk@gmail.com> 4.4.8_LAB1
- Upgrade to PHP 4.4.8

* Sat Jan 05 2008 Ivo Teel <calimonk@gmail.com> 4.4.7_LAB1
- Revised version, based upon 4.3.9-3.22.9_LAB1
- Removed many patches
- PHP Upgrade to 4.4.7

* Sun Dec 30 2007 Ivo Teel <calimonk@gmail.com> 4.3.9-3.22.9_LAB1
- CentOS 5 support by making the RPM as ‘php4′
- Added patch for Net-SNMP 5.2 (http://bugs.php.net/bug.php?id=30995)
- Patched xmlrpc my_free calls (based off http://bugs.php.net/bug.php?id=32150)

The SRPM builds a php4 CLI and CGI binary which you can use, I use ‘php4′ everywhere so it should run fine with PHP5 alongside.

[CaliMonk@DYV001 i386]$ /usr/bin/php4 -v
PHP 4.4.8 (cli) (built: Jan 5 2008 18:22:27)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

[CaliMonk@DYV001 i386]$ /usr/bin/php4-cgi -v
PHP 4.4.8 (cgi) (built: Jan 5 2008 18:21:32)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

[CaliMonk@DYV001 i386]$ uname -a
Linux DYV001 2.6.18-53.1.4.el5PAE #1 SMP Fri Nov 30 01:21:20 EST 2007 i686 i686 i386 GNU/Linux

Building the RPM’s

RPMYou can build with the SRPM yourself, using the instructions I mentioned in my previous post. Basically you only have to do the following (if your BUILD environement is in order!).


[CaliMonk@DYV001 ~]$ wget http://www.labcoding.com/SRPM/php4-4.4.8-LAB3.src.rpm
[CaliMonk@DYV001 ~]$ rpm -ivh php4-4.4.8-LAB3.src.rpm
1:php4 ########################################### [100%]

[CaliMonk@DYV001 ~]$ cd build/redhat/SPECS/
[CaliMonk@DYV001 SPECS]$ rpmbuild -bb php4-4.4.8_LAB3.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.39121
+ umask 022
+ cd /home/CaliMonk/build/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/CaliMonk/build/redhat/BUILD
+ rm -rf php-4.4.8
+ /bin/gzip -dc /home/CaliMonk/build/redhat/SOURCES/php-4.4.8.tar.gz
+ tar -xf -
+ STATUS=0
+ ‘[' 0 -ne 0 ']‘
+ cd php-4.4.8
++ /usr/bin/id -u
+ ‘[' 500 = 0 ']‘
++ /usr/bin/id -u
+ ‘[' 500 = 0 ']‘
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ echo ‘Patch #4 (php-4.2.2-cxx.patch):’

<BIG SNIP>

Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-devel-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-pear-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-imap-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-ldap-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-mysql-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-pgsql-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-odbc-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-snmp-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-domxml-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-xmlrpc-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-mbstring-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-ncurses-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-gd-4.4.8-LAB3.i386.rpm
Wrote: /home/CaliMonk/build/redhat/RPMS/i386/php4-debuginfo-4.4.8-LAB3.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.72337
+ umask 022
+ cd /home/CaliMonk/build/redhat/BUILD
+ cd php-4.4.8
+ ‘[' /var/tmp/php4-root '!=' / ']‘
+ rm -rf /var/tmp/php4-root
+ rm files.domxml files.gd files.imap files.ldap files.mbstring files.mysql files.ncurses files.odbc files.pgsql files.snmp files.xmlrpc
+ exit 0

Download php4-4.4.8-LAB3.src.rpm

Bugs? Remarks? Feel free to leave a comment!

Ivo

Share and Enjoy:
  • Digg
  • del.icio.us
  • Furl
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati