Although 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
You 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
June 21st, 2009
8 Comments at "PHP4 RPM (4.4.8) for CentOS 5"
[...] PHP4 RPM (4.4.8) for CentOS 5Iphone / Ipod touch controlling remote itunes and winamp (windows)Building PHP4 (RPM) on CentOS 5How to control a PC or Mac with the iPhone / Ipod TouchA pesky BHO: cfgmgr3.dll Jan 03 [...]
Thank you for sharing your sources and instructions. I was trying to build this for x86_64 following your instructions but got this error:
#define YYTEXT_POINTER 1
#endif
#ifdef __cplusplus
extern “C” void std::exit (int) throw (); using std::exit;
configure: exit 1
+ make -j4
make: *** No targets specified and no makefile found. Stop.
error: Bad exit status from /var/tmp/rpm-tmp.76743 (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.76743 (%build)
I am not too familiar at all with building SRPMs, but we need PHP4.4.x on a RHEL5.2 (now 5.3) server and this is the first page I’ve come across with a package for our OS. When building PHP4 from source I kept getting errors about MySQL issues:
[root@machine php4.4.9]# ./configure –prefix=/usr/local/php_4.4.9/ –with-apxs2=/usr/local/apache_2.0.63/bin/apxs –with-mysql=/usr/include/mysql –with-gd –with-jpeg-dir=/usr/lib –with-curl –with-openssl –with-zlib –enable-sockets –enable-memory-limit –with-dom –with-dom-xslt –with-dom-exslt –with-ncurses –enable-dbx –enable-dio –enable-experimental-zts –enable-ftp
configure: error: Cannot find MySQL header files under /usr/include/mysql
I fought this for a long time and never resolved it. Does your package work with that?
Additionally, once I build your SRPMs into RPMs and installed them, I cannot seem to get it to run; am I doing something wrong somehow? Really I just wget the file, rpm -ivh that, cd to its unpack dir, and ran ‘rpmbuild -bb php4-4.4.8_LAB3.spec’ then installed the resulting .rpm files in the i386 folder.
[root@machine i386]# /usr/bin/php4 -v
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/domxml.so’ – /usr/lib/php4/domxml.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/gd.so’ – /usr/lib/php4/gd.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/imap.so’ – /usr/lib/php4/imap.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/ldap.so’ – /usr/lib/php4/ldap.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/mbstring.so’ – /usr/lib/php4/mbstring.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/mysql.so’ – /usr/lib/php4/mysql.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/ncurses.so’ – /usr/lib/php4/ncurses.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/odbc.so’ – /usr/lib/php4/odbc.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/pgsql.so’ – /usr/lib/php4/pgsql.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/snmp.so’ – /usr/lib/php4/snmp.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP Warning: Unknown(): Unable to load dynamic library ‘/usr/lib/php4/xmlrpc.so’ – /usr/lib/php4/xmlrpc.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
PHP 4.4.8 (cli) (built: Jan 26 2009 16:30:03)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
[root@machine i386]# ls /usr/lib/php4/
build domxml.so gd.so imap.so ldap.so mbstring.so mysql.so ncurses.so odbc.so pgsql.so snmp.so xmlrpc.so
[root@machine i386]#
Hi,
I believe you’ve forgotten to install the -devel packages, required to build your own packages.
[CaliMonk@DYV001 ~]$ rpm -qf /usr/include/mysql
mysql-devel-5.0.58
So a “sudo yum install mysql-devel” should do the trick.
If you install a RPM, be sure to use sudo. This will ensure the appropriate rights are available.
No, I did they that, still wouldn’t work for me. Can you tell me your configure script for the packages that you’ve provided at
http://www.labcoding.com/linux/php-448-and-eaccelerator-0952-srpms-for-centos-5/
please? Thanks!
I am still getting the errors when I installed your packages as when I installed the rpms created from your source package (above) and the files in question are there, just as before (also above).
My mysql-devel packages are installed as well, but I still get this error:
[root@machine php-4.4.9]# yum install mysql-devel mysql
Loaded plugins: dellsysidplugin, rhnplugin, security
Setting up Install Process
Parsing package install arguments
Package mysql-devel-5.0.45-7.el5.i386 already installed and latest version
Package mysql-5.0.45-7.el5.i386 already installed and latest version
Nothing to do
[root@machine php-4.4.9]# ./configure –prefix=/usr/local/php_4.4.9/ –with-apxs2=/usr/local/apache_2.0.63/bin/apxs –with-mysql=/usr/include/mysql –with-gd –with-jpeg-dir=/usr/lib –with-curl –with-openssl –with-zlib –enable-sockets –enable-memory-limit –with-dom –with-dom-xslt –with-dom-exslt –with-ncurses –enable-dbx –enable-dio –enable-experimental-zts –enable-ftp
…
…
…
…
…
checking for int8… no
checking base type of last arg to accept… socklen_t
checking return type of qsort… void
configure: error: Cannot find MySQL header files under /usr/include/mysql
[root@machine php-4.4.9]#
lefty, you need to disable selinux, or make exceptions for PHP4
Hi,
I followed all the steps with the 4.4.8 src.rpm but I end up with the following error:
extern “C” void std::exit (int) throw (); using std::exit;
configure: exit 1
+ make -j4
make: *** No targets specified and no makefile found. Stop.
error: Bad exit status from /var/tmp/rpm-tmp.81676 (%build)
But I didn’t find any solution. Or indication in what is going wrong. Eventually I modified the spec file so there is no -j4 added, but then I and up with this error:
checking whether to include mime_magic support… yes
configure: error: File ‘/usr/lib64/rpm/magic.mime’ not found!
Please help.
Comment Now!