PHP 5.4 as a "Software Collection"
+
Par Remi le mardi 20 novembre 2012, 08:39 - HowTo - Lien permanent
Software Collections are a way to concurrently install multiple versions of specific software on the same system without affecting standard software packages that are installed on the system with the classic RPM package manager.
You will find some software packaged in this way on the SoftwareCollections project site.
I have just created a new repository for Enterprise Linux (RHEL, CentOS, ...) providing my work on PHP 5.4 RPM adaptation for Software Collections.
Configuration file : rhel-php54.repo (save it in the /etc/yum.repos.d directory)
In this repository, packages are prefixed with php54- and are installed in /opt/rh/php54/root
Installation of PHP command line :
# yum install php54-php-cli
Standard version is still there and is not altered:
$ php --version
PHP 5.3.3 (cli) (built: Oct 23 2012 07:25:18)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
To use a command from the collection, various solutions exist.
Use the standard SCL launcher:
$ scl enable php54 "php --version"
PHP 5.4.8 (cli) (built: Nov 19 2012 06:32:09)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Use the specific launcher:
$ php54-php --version
PHP 5.4.8 (cli) (built: Nov 19 2012 06:32:09)
Enable the collection for the current user:
$ source /opt/rh/php54/enable
$ php --version
PHP 5.4.8 (cli) (built: Nov 19 2012 06:32:09)
For PHP (which is not true for all the collections), you can also directly use the installed commands:
# /opt/rh/php54/root/usr/bin/php --version
PHP 5.4.8 (cli) (built: Nov 19 2012 06:32:09)
For Apache, the collection provides mod_php, built with system standard httpd version.
yum install php54-php
If the php package is already installed, this second mod_php will be silently ignored. If php package is not installed, apache will use the mod_php version 5.4, transparently.
If you want to use another webserver (nginx, lighttpd, ...) or another apache version, for example httpd 2.4 which have its own collection, mod_php will be unusable (different API/ABI), but php-fpm is a working solution.
# yum install php54-php-fpm
# service php54-php-fpm start
See the blog entry about Apache 2.4 and php-fpm.
For MySQL, the collection provides the mysql extension built with the system standard MYSQL version, but you can also use it with another server version, for example MySQL 5.5 which also have its own collection, in this case, it is probably a better solution to use the mysqlnd extension which is independent from the MySQL client library.
Other extensions:
The php54 collection also provides pear (php54-php-pear), APC (php54-php-pecl-apc) and memcache (php54-php-pecl-memcache) extensions.
Conclusion :
I hope this small introduction to "Software Collections" make you feel like trying it. Your feedback is, as always, welcome.
Commentaires
Php updated to 5.4.10