I recently released PHP4 RPM’s for CentOS 5, claiming they worked fine alongside the stock PHP5 that comes with CentOS 5.
Okey, that wasn’t entirely true. I had forgotten about php-pear! If you install php (stock version) alongsides my RPM’s you would get some errors, this has been resolved
After a few days of playing around with my RPM’s, I’ve finally managed to have a php4-pear RPM to work fine alongside php delivered by CentOS. Below an example of my results:
php and php5
$ /usr/bin/php -v PHP 5.1.6 (cli) (built: Sep 20 2007 10:16:10) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies $ /usr/bin/php-cgi -v PHP 5.1.6 (cgi-fcgi) (built: Sep 20 2007 10:06:48) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies $ /usr/bin/php4 -v PHP 4.4.8 (cli) (built: Feb 1 2008 21:28:38) Copyright (c) 1997-2008 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator $ /usr/bin/php4-cgi -v PHP 4.4.8 (cgi) (built: Feb 1 2008 21:27:39) Copyright (c) 1997-2008 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
php4-pear
$ /usr/bin/pear4/pear config-show Configuration (channel pear.php.net): ===================================== Auto-discover new Channels auto_discover Default Channel default_channel pear.php.net HTTP Proxy Server Address http_proxy PEAR server [DEPRECATED] master_server pear.php.net Default Channel Mirror preferred_mirror pear.php.net Remote Configuration File remote_config PEAR executables directory bin_dir /usr/bin/pear4/ PEAR documentation directory doc_dir /docs PHP extension directory ext_dir /usr/lib/php4 PEAR directory php_dir /usr/lib/php4/pear PEAR Installer cache directory cache_dir /tmp/pear4/cache PEAR data directory data_dir /usr/lib/php4/pear/data PEAR Installer download download_dir /tmp/pear4/cache directory PHP CLI/CGI binary php_bin /usr/bin/php4 php.ini location php_ini PEAR Installer temp directory temp_dir /tmp/pear/temp PEAR test directory test_dir /usr/lib/php4/pear/tests Cache TimeToLive cache_ttl 3600 Preferred Package State preferred_state stable Unix file mask umask 22 Debug Log Level verbose 15 PEAR password (for password maintainers) Signature Handling Program sig_bin /usr/bin/gpg Signature Key Directory sig_keydir /etc/pearkeys Signature Key Id sig_keyid Package Signature Type sig_type gpg PEAR username (for username maintainers) User Configuration File Filename /home/CaliMonk/.pearrc System Configuration File Filename /etc/php4/pear.conf
To grab the latest version, enable the Labcoding repository!
$ sudo rpm --import http://www.labcoding.com/yum/centos/RPM-GPG-KEY-Labcoding
Make a labcoding.repo file:
$ sudo vi /etc/yum.repos.d/labcoding.repo
Paste the following:
[Labcoding] name=Labcoding Repository for CentOS $releasever $basearch failovermethod=priority baseurl=http://www.labcoding.com/yum/centos/$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Labcoding
Now update your current PHP files!
$ sudo yum update php4 ============================================================================= Package Arch Version Repository Size ============================================================================= Updating: php4 i386 4.4.8-LAB8 Labcoding 2.3 M Updating for dependencies: php4-devel i386 4.4.8-LAB8 Labcoding 1.3 M php4-domxml i386 4.4.8-LAB8 Labcoding 54 k php4-gd i386 4.4.8-LAB8 Labcoding 103 k php4-imap i386 4.4.8-LAB8 Labcoding 51 k php4-ldap i386 4.4.8-LAB8 Labcoding 37 k php4-mbstring i386 4.4.8-LAB8 Labcoding 912 k php4-mysql i386 4.4.8-LAB8 Labcoding 38 k php4-ncurses i386 4.4.8-LAB8 Labcoding 42 k php4-odbc i386 4.4.8-LAB8 Labcoding 43 k php4-pear i386 4.4.8-LAB8 Labcoding 414 k php4-pgsql i386 4.4.8-LAB8 Labcoding 54 k php4-snmp i386 4.4.8-LAB8 Labcoding 31 k php4-xmlrpc i386 4.4.8-LAB8 Labcoding 56 k Transaction Summary ============================================================================= Install 0 Package(s) Update 14 Package(s) Remove 0 Package(s) Total download size: 5.4 M Is this ok [y/N]:
All set!
If anyone encounters any difficulties, errors or would just like to say thanks, please leave a comment!
Side note: Don’t want to use our repository or grab the SRPM? Be my guest.
Ivo
June 21st, 2009
13 Comments at "PHP4, PHP4 PEAR and PHP5 on CentOS 5"
Hi,
I’ve been testing your RPMs for 2 days and I have a problem so I would like to know if you have tested PHP5 (default on CentOS 5.x) + PHP4 AND Apache 2.2.3 (default on CentOS 5.x too) ?
I’ve tested and after the installation of your RPMs, I’ve seen that neither php.conf (for PHP5) in /etc/httpd/conf.d, neither libphp5.so in /usr/lib/httpd/modules still exist on my server.
So I have taken these 2 files on another server and put them in directories listed above, and now Apache doesn’t want to start and I get this message:
/bin/bash: line 1: 2577 Segmentation fault /usr/sbin/httpd
With the number before “Segmentation fault” which always changes.
Maybe you’ve goot the solution ?
Thanks for your anwser
The location for the PHP5 files are not something i define, it should be /etc/php.ini for PHP5.
My RPM’s are PHP4 RPM’s…
I was able to reproduce your error. You’re trying to load PHP4 and PHP5 on apache, this is obviously not possible.
I’m using PHP4 with apache, PHP5 with Lighttpd/FastCGI.
You should remove /etc/httpd/conf.d/php.conf and php4.conf.
great job, i have a problem with php-mcrypt. if i have to install it, it will install php(5) which I actually don’t need. won’t u please create php-mcrypt that will work on your RPMs? thank yoU!
I dont suppose you have these for x86_64 laying around somewhere? These would be very useful to me but don’t think I have a single i586 machine anywhere anymore.
I had a similar problem with php.conf and libphp5.so being deleted during install. But as I was running this as a virtual server with multiple backups I was able to run another restore those files and then easily reconfigure apache to run with php5 as a module and php4 in virtual hosts as a cgi to use suexec. Works perfectly now!
Hi,
Wonderful work, really useful for me.
But same problem here : mcrypt is missing ! Did you released it ?
Thanks !
Alex
I did indeed re-release the packages, due to some updates with my CentOS machine.
Unfortunately, after updating to CentOS 5.2 I was unable to get PHP4 properly working.
Due to time constraints I’ve upgraded the machine to PHP5 to see how it went.
I’ll try to update the RPM’s soon to resolve the final issues.
@Tom:
You can just download the SRPMS and compile it yourself. The source RPM’s are not specific for x86_64
I\’l be back…
5
Where to get a libphp4.so compatible with your packages for CentOS 5.2?
[...] You need to install both php5 and php4 rpms. Once done update httpd.conf to serve *.php5 file as php5 and *.php4 as php4. Labcoding Blog Archive PHP4, PHP4 PEAR and PHP5 on CentOS 5 [...]
Gr8 stuff – I have it installed but managed to corrupt php-common by trying to upgrade to php5! It was working fine before but now gives a slew of errors about missing dynamic libraries /usr/lib.php4/dbase.so etc.
The php.net site does not seem to contain archives so is there a version somewhere? How specific are the php-common components to the php version? I know that 5.1.16 doesn’t work!
Comment Now!