Insights and news on Red Hat developer tools, platforms and more

PHP 5.4 on RHEL-6 using RHSCL

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.


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
 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 😉


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
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
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…).


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

  • Jeff Bilbro

    Will this ever leave beta status and be supported for production use?

  • It’s strange that APC is included and not zendopcache, since the latter one is supported since PHP 5.2 and now officially included in PHP 5.5 (as shipping with RHEL 5.10) whereas APC was never considered stable on PHP 5.4 (in so much that Red Hat is shipping a version from subversion rather than a proper released version). We have been using zendopcache for some time with PHP 5.4 with great result and are considering to move to RHSCL 1.0, but the lack of zendopcache and xhprofile is a real concern.

  • zendopcache would probably be the better choiche here, but until this is added the collection already offers some benefits over the defaults that is highly needed. PHP 5.3.3 is getting more and more difficult to support with it’s edge case issues not found in newer versions.

    • I overlooked the “opcode cache is disabled as not considered stable for PHP 5.4” part.
      If this is the case, this is not really usable.

      • dagwieers

        That statement is disputed 😉

  • Same here, we would really need Zend OPcache as APC is not considered stable.

  • Enabled PHP/php-cgi version should be controlled by update-alternatives command.

    • Software Collections enables the php version to be run “per app.” Update-alternatives is trying to solve a different problem, changing the whole machine to use a different version of “something” (in this case, php). The one is not exclusive of the other.

  • Pingback: Our Top 12 Blog Articles of 2013 | Red Hat Developer Blog()

  • Pingback: Apache httpd 2.4 on Red Hat Enterprise Linux 6 | Red Hat Developer Blog()

  • Pingback: Upgrading PHP 5.3.3 to 5.4 CentOS 6.4 (Transaction Check Error)()

  • zhj

    Could you please explain Use from Apache more. How do I enable this from Apache? What is the standard module?

    • We cover Apache + PHP more in some other articles. One really useful one is . You can also look at the “apache tag” for more articles about Apache httpd.

  • Pingback: Installing php 5.4 or 5.5 on CentOS 6.x / RHEL 6.x / SL 6.x « Sig-I/O Automatisering()

  • Opcache is included, it can be installed with “php54-php-pecl-zendopcache.x86_64”

    Actually the article seems to be wrong, its APC which is not stable with PHP 5.4, opcache is shipped by default with PHP 5.5 already (while not enabled).

    SCL is a nice move by Red Hat, in particular because most vendors are dropping support for 5.3* and require as minimum PHP 5.4* and this will cause a major pain for users still on RHEL6. While the move to support a newer version is nice, the extra packages are not, things like mcrypt and other required and used popular modules should be available as default if someone wants a working PHP system. It seems this project and idea is half baked, unless Red Hat puts someone working on this or they plan to update the official PHP package allot of users using RHEL 6 and clones are going to start suffering with PHP apps in a very short future…even popular open source applications are not supporting PHP 5.3.3 anymore.

  • Kev

    Installing php54-php with apache 2.2.15 works fine, however when installing apache 2.4 from SCL configuring to use php54-php (mod_php) we are seeing the following message:

    service httpd24-httpd start
    Starting httpd: httpd: Syntax error on line 353 of /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf: Syntax error on line 6 of /opt/rh/httpd24/root/etc/httpd/conf.d/php54-php.conf: Cannot load modules/ into server: /opt/rh/httpd24/root/etc/httpd/modules/ undefined symbol: unixd_config

    Any ideas on why the php54-php (SCL) doesn’t appear to be compatible with the apache version in the SCL?