Multiple PHP versions - does it matter if module streams are not enabled?

Hi there,

Thanks to @jlehtone I was able to upgrade my MariaDB to a later version.

I am now wanting to run two versions of PHP (version 7.4 and 8.2). I have kind of got it working but my lack of understanding regarding module streams has me a little confused.

I started by switching to the Alma PHP 8.2 stream as follows:

dnf module enable php:8.2

dnf update

Now when I do php -v it tells me I am using version 8.2

Next I install Remi’s repo:

dnf install http://rpms.remirepo.net/enterprise/remi-release-9.rpm

Then:

dnf module reset php
dnf module enable php:remi-7.4
dnf install php74 php74-php-fpm -y

Now when I do php -v it reports version 8.2 and if I do php74 -v it reports version 7.4. This is exactly what I want, so it appears to be working.

However if I do dnf module list php it shows the 7.4 module enabled. Or I can enable the 8.2 module, or not enable any of them.

When none of them are enabled the php -v and php74 -v commands still work and report the corresponding versions.

I am not sure of the significance of an “enabled” module versus one that isn’t enabled.

Will my php8.2 and php7.4 modules both receive updates if neither is enabled?

Is there something else I should do, or a better way of achieving this?

Thanks!

The “DNF module” is a filter that affects what dnf sees from repo. At most one stream of a module can be enabled. It is like listing in --exclude= all the PHP package versions that are not in the enabled stream. In other words the module config affects what package (versions) you can install (and update). Since the module config is in your machine, and two repos offer module “php”, they are both affected. If php:remi-7.4 stream is enabled, then only that subset of php packages are visible.


The modules do not affect what you have installed; only what you can install.
You have installed packages that provide commands php and php74. Therefore, you can run those commands. “Luckily” for you, the php:remi-7.4 packages did not replace the php command/package, so you still have the php 8.2 too. (Every PHP stream from alma has command php, so one can have only one of them.)

You should ask from @remi about that.

In other words the module config affects what package (versions) you can install (and update)

That’s the main part I am unclear on. Now that I have PHP8.2 and PHP7.4 installed, but neither module enabled, will they get updated in the future when I run dnf update or does the module need to be enabled in order for the corresponding package to receive updates?

If a stream is disabled, then packages belonging to that stream are not visible in the repo. Not available to be installed. The dnf up will thus exclude them; not update them.

Okay, I think (and hope) I’ve resolved it, by enabling (and installing) the PHP 8.2 module.

I removed Remi’s PHP 7.4 and started again. I enabled the PHP 8.2 module. Then I simply did dnf install php74which I think has installed Remi’s PHP7.4 but not as a module.

I am back to having both versions installed, and hope that this way they both receive updates.

1 Like

My repo provides 2 way to install PHP

  • modules (single/default version)
  • Software collections (multiple versions)

Best, is to follow the wizard instruction
https://rpms.remirepo.net/wizard/

I am back to having both versions installed, and hope that this way they both receive updates.

Yes

1 Like