Can't downgrade PHP from 8.0 to 7.2

Hey everyone,

I upgraded from the default PHP 7.2 to 8.0 with:

dnf module list php
dnf module reset php
dnf module enable php:8.0
dnf module update php:8.0

It worked fine, I was able to test my application and then I decided to go back to the default php 7.2:

dnf module list php
dnf module reset php
dnf module enable php:7.2
dnf module update php:7.2

Unfortunately this does not work. The first 3 commands work fine, but the 4th command (dnf module update php:7.2) does nothing:

# dnf module update php:7.2
Dependencies resolved.
Nothing to do.
Complete!

Now I’m stuck with a system that has php 7.2 by default (confirmed with dnf module list php, but with php 8.0 installed. Any suggestions please?

Thank you.

As the name states, “update” is used to upgrade, not to downgrade :wink:

The proper command to change a stream version is “switch-to”

# dnf module switch-to php:7.2
Dependencies resolved.
============================================================================================================================================================================================================================
 Package                                         Architecture                               Version                                                                     Repository                                     Size
============================================================================================================================================================================================================================
Downgrading:
 libzip                                          x86_64                                     1.5.1-2.module_el8.2.0+313+b04d0a66                                         appstream                                      62 k
 php-cli                                         x86_64                                     7.2.24-1.module_el8.2.0+313+b04d0a66                                        appstream                                     3.1 M
 php-common                                      x86_64                                     7.2.24-1.module_el8.2.0+313+b04d0a66                                        appstream                                     661 k
 php-pear                                        noarch                                     1:1.10.5-9.module_el8.2.0+313+b04d0a66                                      appstream                                     358 k
 php-process                                     x86_64                                     7.2.24-1.module_el8.2.0+313+b04d0a66                                        appstream                                      84 k
 php-xml                                         x86_64                                     7.2.24-1.module_el8.2.0+313+b04d0a66                                        appstream                                     188 k
Switching module streams:
 php                                                                                        8.0 -> 7.2                                                                                                                     

Transaction Summary
============================================================================================================================================================================================================================
Downgrade  6 Packages

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

The dnf distro-sync command may also help.

NOTICE: php:7.2 stream is EOL and no more supported.

php:7.4 will be maintained for the full distribution life.

For more information, read: RHEL 8 Rolling Application Streams Release Life Cycle

AHA! Obviously I’ve never had to downgrade before, I didn’t know about “switch-to”!

Thank you for the explanation, I appreciate it.