Official announcement : Red Hat Software Collections 1.0 Beta Now Available
More information on Software Collections
Stability addicts can keep quiet, PHP 5.3.3 is still the standard version provided with RHEL-6.
We'll soon have an official and supported way to install PHP version 5.4, beside the system version, without any effect on installed components. The announcement tells us the life cycle will be 3 years.
Warning: it's a beta version, published for evaluation purposes.
Installation
Activation of the distribution channel (requires a valid subscription) from the RHN web interface or from command line:
# rhn-channel --add --channel=rhel-x86_64-server-6-rhscl-1-beta
Installation of the meta-package and default components:
# yum install php54 ... ====================================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================================== Installing: php54 x86_64 1-7.el6 rhel-x86_64-server-6-rhscl-1-beta 3.3 k Installing for dependencies: php54-php-cli x86_64 5.4.14-3.el6 rhel-x86_64-server-6-rhscl-1-beta 2.6 M php54-php-common x86_64 5.4.14-3.el6 rhel-x86_64-server-6-rhscl-1-beta 566 k php54-php-pear noarch 1:1.9.4-7.el6 rhel-x86_64-server-6-rhscl-1-beta 370 k php54-php-process x86_64 5.4.14-3.el6 rhel-x86_64-server-6-rhscl-1-beta 45 k php54-php-xml x86_64 5.4.14-3.el6 rhel-x86_64-server-6-rhscl-1-beta 109 k php54-runtime x86_64 1-7.el6 rhel-x86_64-server-6-rhscl-1-beta 1.0 M Transaction Summary ====================================================================================================================================================== Install 7 Package(s) Total download size: 4.7 M Installed size: 0 Is this ok [y/N]: y
That's all ;)
Utilisation
Default version still 5.3.3
# php -v PHP 5.3.3 (cli) (built: Nov 29 2012 04:12:23) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
You need to explicitly ask to use the SCL version, standard (SCL) way:
# scl enable php54 "php -v" PHP 5.4.14 (cli) (built: May 23 2013 07:42:19) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
You can also use (for this collection, not supported for others):
# /opt/rh/php54/root/usr/bin/php -v PHP 5.4.14 (cli) (built: May 23 2013 07:42:19) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
You can also permanently activate the collection:
# source /opt/rh/php54/enable # php -v PHP 5.4.14 (cli) (built: May 23 2013 07:42:19) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Use from Apache
Various ways exist (CGI, FastCGI,...) we'll only see the mod_php case
# yum install php54-php
Warning : apache can't load 2 php5 modules, so if the standard module is already present, on apache startup, you will get the error message:
[Sun Jun 16 16:51:01 2013] [warn] module php5_module is already loaded, skipping
You need to uninstall (or disable) the standard module, and then apache will use the PHP 5.4 from the collection.
PEAR extensions
See : PHP Extension and Application Repository
The collection has a dedicated pear installation tree (/opt/rh/php54/root/usr/share/pear), which means that pear extensions are not shared between system and collection.
# pear list Installed packages, channel pear.php.net: ========================================= Package Version State Archive_Tar 1.3.7 stable Console_Getopt 1.2.3 stable PEAR 1.9.4 stable Structures_Graph 1.0.4 stable XML_RPC 1.5.4 stable XML_Util 1.2.1 stable # scl enable php54 "pear list" Installed packages, channel pear.php.net: ========================================= Package Version State Archive_Tar 1.3.11 stable Console_Getopt 1.3.1 stable PEAR 1.9.4 stable Structures_Graph 1.0.4 stable XML_Util 1.2.1 stable
The pear command can be used to install more extensions in the collection.
PECL extensions
See : PECL extension repository
Currently available in the collection:
- memcache extension: php54-php-pecl-memcache.
- APC extension, provided for user data cache only (opcode cache is disabled as not considered stable for PHP 5.4): php54-php-pecl-apc and php54-apc-panel.
The pecl command can be used in the collection to manually install (build) more extensions. Those extensions will be available in the collection without altering the default system PHP.
Some experimental packages of commonly needed extensions are available in my personal testing repository. (interbase, mssql, mcrypt, apcu, igbinary, imagick, mongo, radius, sphinx, xhprof, xdebug, zendopcache...).
Conclusion
I think this is a very important new feature which should help the adoption of more recent PHP versions in enterprise environment.
RHEL clone users can also try the packages available on the community project site : Software Collections