centos – yum downgrade and automatically include all dependencies?

One way is to downgrade all PHP packages

yum-config-manager --disable 'remi-php*'
yum-config-manager --enable   remi-php74
yum downgrade php\*
yum update

First, ensure proper repository configuration, so only the expected PHP version is available.

Then, as the downgrade command may downgrade some packages not from PHP stack itself (pecl extensions, noarch libraries) the final update will bring all the latest versions.

An alternative way, probably better if no manually installed RPM:

yum-config-manager --disable 'remi-php*'
yum-config-manager --enable   remi-php74
yum distro-sync

But please notice that CentOS 7 is now terribly old and close to its end of life in less than 1 year, updating to a more recent version is recommended.

Such downgrade is much easier on EL-8 or EL-9 thanks to modularity (switching enabled stream will sync all packages in this stream).

dnf module switch-to php:remi-7.4

Read more here: Source link