1. Installation

ISO image is available for everyone, see the README file.

Don't forget to enable the Beta repositories.

# dnf repolist
repo id                               repo name                                                     status
rhel-8-for-x86_64-appstream-beta-rpms Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs) 4594
rhel-8-for-x86_64-baseos-beta-rpms    Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)    1686

2. Installation of PHP

PHP is not part of BaseOS which is the base of the Operating System, reduced to minimal, but is available in AppStream, i.e. as a module.

# dnf module list
Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
php                  7.1          devel, minimal, defaul PHP scripting language                           
                                  t [d]                 
php                  7.2 [d]      devel, minimal, defaul PHP scripting language                           
                                  t [d]                  

You can see that both versions 7.1 and 7.2 (default) are available.

Installation of version 7.1

# dnf module install php:7.1
Dependencies resolved.
==========================================================================================================
 Package            Arch     Version                        Repository                               Size
==========================================================================================================
Installing group/module packages:
 php-cli            x86_64   7.1.20-2.el8+1700+11d526eb     rhel-8-for-x86_64-appstream-beta-rpms   2.9 M
 php-common         x86_64   7.1.20-2.el8+1700+11d526eb     rhel-8-for-x86_64-appstream-beta-rpms   624 k
 php-fpm            x86_64   7.1.20-2.el8+1700+11d526eb     rhel-8-for-x86_64-appstream-beta-rpms   1.5 M
 php-json           x86_64   7.1.20-2.el8+1700+11d526eb     rhel-8-for-x86_64-appstream-beta-rpms    70 k
 php-mbstring       x86_64   7.1.20-2.el8+1700+11d526eb     rhel-8-for-x86_64-appstream-beta-rpms   547 k
 php-xml            x86_64   7.1.20-2.el8+1700+11d526eb     rhel-8-for-x86_64-appstream-beta-rpms   187 k
Installing dependencies:
 httpd-filesystem   noarch   2.4.35-6.el8+2089+57a79027     rhel-8-for-x86_64-appstream-beta-rpms    32 k
 nginx-filesystem   noarch   1:1.14.0-3.el8+1631+ba902cf0   rhel-8-for-x86_64-appstream-beta-rpms    23 k
Installing module profiles:
 php/default                                                                                             
Enabling module streams:
 httpd                       2.4                                                                         
 nginx                       1.14                                                                        
 php                         7.1                                                                         

Transaction Summary
==========================================================================================================
Install  8 Packages

Total download size: 5.9 M
Installed size: 20 M
Is this ok [y/N]: y

Result:

# php -v
PHP 7.1.20 (cli) (built: Jul 19 2018 06:17:27) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

And you can switch easily to  7.2

# dnf module install php:7.2
Dependencies resolved.
==========================================================================================================
 Package         Arch      Version                         Repository                                Size
==========================================================================================================
Upgrading:
 php-cli         x86_64    7.2.11-1.el8+2002+9409c40c      rhel-8-for-x86_64-appstream-beta-rpms    3.1 M
 php-common      x86_64    7.2.11-1.el8+2002+9409c40c      rhel-8-for-x86_64-appstream-beta-rpms    653 k
 php-fpm         x86_64    7.2.11-1.el8+2002+9409c40c      rhel-8-for-x86_64-appstream-beta-rpms    1.6 M
 php-json        x86_64    7.2.11-1.el8+2002+9409c40c      rhel-8-for-x86_64-appstream-beta-rpms     73 k
 php-mbstring    x86_64    7.2.11-1.el8+2002+9409c40c      rhel-8-for-x86_64-appstream-beta-rpms    580 k
 php-xml         x86_64    7.2.11-1.el8+2002+9409c40c      rhel-8-for-x86_64-appstream-beta-rpms    188 k
Switching module streams:
 php                       7.1 -> 7.2                                                                    

Transaction Summary
==========================================================================================================
Upgrade  6 Packages

Total download size: 6.2 M
Is this ok [y/N]: y

Result:

# php -v
PHP 7.2.11 (cli) (built: Oct  9 2018 15:09:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

3. Web usage

3.1 with Apache HTTP Server

Installation:

# dnf module install httpd

Service activation:

# systemctl enable --now php-fpm
# systemctl enable --now httpd

Test page:

# echo '<?php phpinfo();' >/var/www/html/info.php

Then you can browse to http://localhost/info.php

3.2 with nginx

Installation:

# dnf module install nginx

Services activation:

# systemctl enable --now php-fpm
# systemctl enable --now nginx

Test page:

# echo '<?php phpinfo();' >/usr/share/nginx/html/info.php

Then you can browse to http://localhost/info.php

4. Conclusion

Fedora users won't be surprised, RHEL users can now take benefits of work done on PHP packages since F19:

  • php-fpm used by default
  • httpd using MPM event by default, and php working without any configuration change
  • nginx available, and php working without any configuration change

Usage of modules should improve flexibility in version choice, and usability, and of course, we can expect new versions sooner (e.g. php 7.3).

Some (like me) will miss the Software Collections and so the possible installation of multiple versions simultaneously (still possible using containers).