PHP4I 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

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