Topic: PHP 7.2 under Rocky 8

I have been tasked with installing PHP 7.2 under Rocky 8.9 along with several other components, including ext-mondodb. I am aware that both of these things are old, but it is the task I have been dealt. I have been stuck in CentOS 7 world until very recently, and am new to the world of appstreams, though I was able to make the Remi php-7.2 stream both enabled and default:

php app streams

7.2 is the version of PHP available in the base Rocky 8 repos, but it does not have nearly enough software support required for this particular application even with EPEL. The issues I am having:

* Remi PHP 7.2 packages insist on installing to /opt/remi/php72/{user}/{standard OS path} instead of in their standard system locations
* Executing "sudo dnf install php" still attempts to install PHP 8.3, even though the 7.2 repo is the only stream enabled
* In order to get 7.2 packages to install, they still must be prefixed with "php72-"
* The prefix rule applies to php itself, where "sudo dnf install php72" must be specified
* After installing php72, not only does the install base set itself in /opt, but the php command-line binary is "php72" instead of just "php"

It seems that some of these issues can be hacked around with post-installation symlinks, but that seems like a recipe for instability and disaster.

Is there any way to configure the Remi repo so that PHP version 7.2 packages install to their standard locations and with their standard names under Rocky Linux 8?

Re: PHP 7.2 under Rocky 8

> Is there any way to configure the Remi repo so that PHP version 7.2 packages install to their standard locations and with their standard names under Rocky Linux 8?

For a proper repository configuration and usage, follow the Wizard instructions

https://rpms.remirepo.net/wizard/

In particular, see installation mode (Default / Single version or Multiple versions)

Laptop:  Fedora 40 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: AlmaLinux 8 with EPEL, rpmfusion, remi

Re: PHP 7.2 under Rocky 8

Thank you for the quick response! While following the wizard, I run into an error while attempting a "dnf module install":

]# dnf module install php:remi-7.2
Default profile server not available in module php:remi-7.2
Error: Problems in request:
broken groups or modules: php:remi-7.2

Am I doing something wrong?

Re: PHP 7.2 under Rocky 8

Strange:

# dnf module switch-to php:remi-7.2
Last metadata expiration check: 1 day, 1:30:15 ago on Thu Jun  6 15:57:59 2024.
Dependencies resolved.
=========================================================================================================================
 Package                     Architecture               Version                        Repository                   Size
=========================================================================================================================
Switching module streams:
 php                                                    remi-8.2 -> remi-7.2                                            

Transaction Summary
=========================================================================================================================

Is this ok [y/N]: y
Complete!

# dnf module install php:remi-7.2
Last metadata expiration check: 1 day, 1:30:35 ago on Thu Jun  6 15:57:59 2024.
Dependencies resolved.
=========================================================================================================================
 Package                  Architecture   Version                                              Repository            Size
=========================================================================================================================
Installing group/module packages:
 php-cli                  x86_64         7.2.34-22.el8.remi                                   remi-modular         4.7 M
 php-common               x86_64         7.2.34-22.el8.remi                                   remi-modular         1.1 M
 php-fpm                  x86_64         7.2.34-22.el8.remi                                   remi-modular         1.6 M
 php-mbstring             x86_64         7.2.34-22.el8.remi                                   remi-modular         515 k
 php-xml                  x86_64         7.2.34-22.el8.remi                                   remi-modular         235 k
Installing dependencies:
 php-json                 x86_64         7.2.34-22.el8.remi                                   remi-modular          76 k
Installing weak dependencies:
 nginx-filesystem         noarch         1:1.14.1-9.module_el8.3.0+2165+af250afe.alma         appstream             23 k
Installing module profiles:
 php/common                                                                                                             

Transaction Summary
=========================================================================================================================
Install  7 Packages

Total download size: 8.2 M
Installed size: 34 M
Is this ok [y/N]: 

P.S. check enabled repositories (dnf repolist)

Laptop:  Fedora 40 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: AlmaLinux 8 with EPEL, rpmfusion, remi

5 (edited by cturner 2024-06-07 21:05:15)

Re: PHP 7.2 under Rocky 8

Odd - I was able to get past the error by disabling the mongodb.org repo. This is the remaining list:

repo id                                                  repo name
appstream                                                Rocky Linux 8 - AppStream
baseos                                                   Rocky Linux 8 - BaseOS
epel                                                     Extra Packages for Enterprise Linux 8 - x86_64
extras                                                   Rocky Linux 8 - Extras
remi                                                     Remi's RPM repository for Enterprise Linux 8 - x86_64
remi-modular                                             Remi's Modular repository for Enterprise Linux 8 - x86_64
remi-safe                                                Safe Remi's RPM repository for Enterprise Linux 8 - x86_64

But now, when following the steps in the Wizard, it is still trying to install PHP 8.3.8:

]# dnf module switch-to php:remi-7.2
Last metadata expiration check: 0:32:52 ago on Fri 07 Jun 2024 03:20:20 PM CDT.
Dependencies resolved.
================================================================================================================================================================
 Package                               Architecture                         Version                                 Repository                             Size
================================================================================================================================================================
Enabling module streams:
 php                                                                        remi-7.2

Transaction Summary
================================================================================================================================================================

Is this ok [y/N]: y
Complete!
[root@localhost ~]# dnf module list php
Last metadata expiration check: 0:33:08 ago on Fri 07 Jun 2024 03:20:20 PM CDT.
Rocky Linux 8 - AppStream
Name                         Stream                              Profiles                                          Summary
php                          7.2 [d]                             common [d], devel, minimal                        PHP scripting language
php                          7.3                                 common [d], devel, minimal                        PHP scripting language
php                          7.4                                 common [d], devel, minimal                        PHP scripting language
php                          8.0                                 common [d], devel, minimal                        PHP scripting language
php                          8.2                                 common [d], devel, minimal                        PHP scripting language

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name                         Stream                              Profiles                                          Summary
php                          remi-7.2 [e]                        common [d], devel, minimal                        PHP scripting language
php                          remi-7.3                            common [d], devel, minimal                        PHP scripting language
php                          remi-7.4                            common [d], devel, minimal                        PHP scripting language
php                          remi-8.0                            common [d], devel, minimal                        PHP scripting language
php                          remi-8.1                            common [d], devel, minimal                        PHP scripting language
php                          remi-8.2                            common [d], devel, minimal                        PHP scripting language
php                          remi-8.3                            common [d], devel, minimal                        PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@localhost ~]# dnf module install php:remi-7.2
Last metadata expiration check: 0:33:26 ago on Fri 07 Jun 2024 03:20:20 PM CDT.
Dependencies resolved.
================================================================================================================================================================
 Package                             Architecture              Version                                                    Repository                       Size
================================================================================================================================================================
Installing group/module packages:
 php-cli                             x86_64                    8.3.8-1.el8.remi                                           remi-modular                    5.6 M
 php-common                          x86_64                    8.3.8-1.el8.remi                                           remi-modular                    1.3 M
 php-fpm                             x86_64                    8.3.8-1.el8.remi                                           remi-modular                    2.0 M
 php-mbstring                        x86_64                    8.3.8-1.el8.remi                                           remi-modular                    583 k
 php-xml                             x86_64                    8.3.8-1.el8.remi                                           remi-modular                    270 k
Installing dependencies:
 libxslt                             x86_64                    1.1.32-6.el8                                               baseos                          249 k
 oniguruma5php                       x86_64                    6.9.9-1.el8.remi                                           remi                            213 k
Installing weak dependencies:
 nginx-filesystem                    noarch                    1:1.14.1-9.module+el8.4.0+542+81547229                     appstream                        23 k
Installing module profiles:
 php/common

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

Total download size: 10 M
Installed size: 47 M
Is this ok [y/N]: n

Is there a setting somewhere that could cause it to still want to install PHP 8.3?

Re: PHP 7.2 under Rocky 8

Really strange, never saw this...

Sorry, I don't understand
and no idea how to fix this

Perhaps too many tries and config changes.... may be better to restart with a fresh install.

Laptop:  Fedora 40 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: AlmaLinux 8 with EPEL, rpmfusion, remi

Re: PHP 7.2 under Rocky 8

I was afraid of that. I must have executed "dnf autoremove ___" too many times while shuffling repos around. Thanks again for your help!

Re: PHP 7.2 under Rocky 8

After thinking about this issue, the only explanation I was able to find is that the "remi-modular" repository is used as a "flat" repo instead of a "modular" repo (so 8.3 is the highest version).

This is possible when using a badly created local mirror (without the proper metadata)
Or when using some dnf options (such as module_hotfixes=1)

Before using a new fresh install you can try to remove the "remi-release" package (and all the remi*repo files)
and then try to install it again to ensure you are using the default configuration and the online official content

Laptop:  Fedora 40 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: AlmaLinux 8 with EPEL, rpmfusion, remi

9 (edited by cturner 2024-06-09 13:06:01)

Re: PHP 7.2 under Rocky 8

That was it! I forgot about putting module_hotfixes=true in remi-modular.repo after reading a post recommending it as a solution to a separate issue. I commented that line out and the install module php:remi-7.2 command now wants to install the correct 7.2 packages.

The reason I had module_hotfixes in there was because of errors being thrown while trying to install the php-alcaeus-mongo-php-adapter package. Without the setting, the system can't seem to work out the dependencies. I realize that this is another issue entirely, but is there something I might be able to do to get this working, short of using composer to install the alcaeus library on top of the php-pecl-mongodb-1.16 extension that dnf is willing to install?

]# yum install php-alcaeus-mongo-php-adapter
Last metadata expiration check: 0:01:28 ago on Sun 09 Jun 2024 07:43:23 AM CDT.
Error:
 Problem: package php-alcaeus-mongo-php-adapter-1.2.5-1.el8.remi.noarch from remi requires php-composer(mongodb/mongodb) >= 1.0.1, but none of the providers can be installed
  - package php-mongodb-1.18.0-1.el8.remi.noarch from remi requires php-pecl(mongodb) >= 1.18.0, but none of the providers can be installed
  - package php-mongodb-1.19.0-1.el8.remi.noarch from remi requires php-pecl(mongodb) >= 1.18.0, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package php-pecl-mongodb-1.19.1-1.el8.remi.7.4.x86_64 from remi-modular is filtered out by modular filtering
  - package php-pecl-mongodb-1.19.1-1.el8.remi.8.0.x86_64 from remi-modular is filtered out by modular filtering
  - package php-pecl-mongodb-1.19.1-1.el8.remi.8.1.x86_64 from remi-modular is filtered out by modular filtering
  - package php-pecl-mongodb-1.19.1-1.el8.remi.8.2.x86_64 from remi-modular is filtered out by modular filtering
  - package php-pecl-mongodb-1.19.1-1.el8.remi.8.3.x86_64 from remi-modular is filtered out by modular filtering
  - package php-pecl-mongodb-1.19.2-1.el8.remi.7.4.x86_64 from remi-modular is filtered out by modular filtering
  - package php-pecl-mongodb-1.19.2-1.el8.remi.8.0.x86_64 from remi-modular is filtered out by modular filtering
  - package php-pecl-mongodb-1.19.2-1.el8.remi.8.1.x86_64 from remi-modular is filtered out by modular filtering
  - package php-pecl-mongodb-1.19.2-1.el8.remi.8.2.x86_64 from remi-modular is filtered out by modular filtering
  - package php-pecl-mongodb-1.19.2-1.el8.remi.8.3.x86_64 from remi-modular is filtered out by modular filtering
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

If I'm reading this right, it's trying to find a package php-pecl-mongodb-1.19.1-1.el8.remi.7.2.x86_64 which doesn't exist in the repo. Is that correct?

Re: PHP 7.2 under Rocky 8

>  - package php-mongodb-1.19.0-1.el8.remi.noarch from remi requires php-pecl(mongodb) >= 1.18.0, but none of the providers can be installed

Sorry but this is expected

It is not possible (too much work, not enough resource) to maintain "noarch" packages
got all available PHP versions

PHP applications and libraries are only available for supported versions (so 8.1+)

And indeed latest php-mongodb requires latest php-pecl-mongodb which requires PHP 7.4+


But most PHP users don't use system libraries anymore
but prefer to install them locally using composer

Why do you think you need this package ?

Laptop:  Fedora 40 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: AlmaLinux 8 with EPEL, rpmfusion, remi

Re: PHP 7.2 under Rocky 8

I was just trying to keep the setup process simple. If the last step of getting the Alcaeus library installed involves composer, I can live with it. Thank you so much for your help - it is greatly appreciated!