Why does rh-php71 not provide php >= 7?

Latest response

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 should still be able to access PHP 7.0 software collection, rh-php70. See https://access.redhat.com/documentation/en-us/red_hat_software_collections/3/html-single/3.0_release_notes/index#sect-RHSCL-Features.

no, this will also not solve my issue. I think you misunderstood me. I have a PHP application which depends on PHP >= 7. To deploy the application I want to use the package manager and define a Require rule in the RPM specfile which tells the system that this package requires php >= 7, If i do so, the installation fails because there is no package in the Red Hat repositories which solves this dependency - even though red hat serves php 7 over the SCL. So my question is why does the SCL PHP package does not provide the information that this package offers PHP >= 7 and what would be the solution to solve this problem without specifying explizit the scl package - which I could do but in my opinion this is bad because I don´t want to change the spec file only because i want to use a newer php version. I just want to say that this is my application and the application will run with php >= 7.

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!

I now understand why rh-php71 does not solve my requirement and I will build my package without a dependency. Thanks for the help, regards

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/

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.