Why does rh-php71 not provide php >= 7?
Hello!
I have to use Red Hat for a Project, where we develop a web application. The web application depends on PHP 7, which is available in red hat by using software collections. We now want to create a rpm package for the application which has a requirement for php 7, The installation fails, because no package provides php in this version.
Why does the php SCL does not satisfy my requirement?
What is the way to solve this issue in Red Hat world? Do I have to create my own Software collection where i provide my application, a webserver and php7 and maintain it?
Responses
You will likely find the reason that the RHSC package doesn't provide PHP >= 7 is because this would cause issues/conflicts with the primary supported 5.4 version that Red Hat ships with the distro (which the RHSC version isn't). RHSC packages are essentially sideloaded into the OS, so some concessions need to be made so they can co-exist with the primary system packages. Having an RHSC package provide a newer version of an OS package would cause major problems if someone were to yum update as no other packages shipped in RHEL which require PHP are tested against PHP7.
If you specifically need a RHSC package for your app on the EL7 platform, my suggestion would be to explicitly reference the package name as you have mentioned.
I expect this kind of problem will be addressed with 'modularity' in RHEL 8.
https://docs.pagure.org/modularity/
A small follow up on modularity, with this Fedora post:
https://fedoramagazine.org/nine-reasons-use-fedora-modules-container-images/
What I find particularly interesting is the comment in item 9 about Software Collections:
If you ever played with Software Collections, or even tried to create a container image based on an existing collection, you might got to a point when it was too complicated:
RPMs installed into a separate tree in /opt
the need to scl enable a collection
and for sure, a bunch of hacks
Our goal is to make those pain points history. Why? Modules are installed directly in your root filesystem, you don’t need dedicated tooling to use the modules and… no hacks
I'd say this is a sure thing for RHEL 8 if anyone is taking bets.
Hi Thomas,
Typically packages which "Requires: php" expect PHP support in the system httpd, whereas with the RHSCL packages you'll get PHP support in the httpd24 collection. Because the RHSCL packages are not drop-in replacements for system packages they can't have the same set of Provides; any third-party package using an SCL-ized PHP has to be adapted to the special paths, or to use httpd24's httpd, etc.
The appropriate way to depend on the RHSCL php is e.g. "Requires: httpd24-mod_php".
Hope that helps!
Depending on your environmental constraints, another option is to create or pull a php71 docker container and use docker to provide your app requirements.
The Red Hat container catalog has Apache 2.4 + PHP 7.1 here
https://access.redhat.com/containers/?tab=overview#/registry.access.redhat.com/rhscl/php-71-rhel7
The official php repo also has multiple 7.1 images
https://hub.docker.com/_/php/
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
