Guide
Installing and Switching PHP Versions with CentOS Stream Application Streams
Learn how to enable a CentOS Stream Application Stream (e.g., PHP 8.2) to run a newer package version while keeping the base OS unchanged, with verification and rollback steps.
Published by Tasadduq Burney
16 Mar 2026, 23:01 UTC
3 min121.7K views0

Desired Outcome
Enable a specific Application Stream (for example, PHP 8.2) on a CentOS Stream 9 system while keeping the base OS release unchanged. This allows you to run a newer user‑space package without upgrading the entire distribution.
Prerequisites
- A freshly installed CentOS Stream 9 system.
- Root privileges or the ability to use
sudo. - The
dnfpackage manager updated (dnf update -y). - Basic familiarity with terminal commands.
Procedure
- Update the package metadata
sudo dnf update -y - List available modules to see which Application Streams are offered.
Look for lines likednf module listphp 8.0 [d] 8.1 [e] 8.2where the letter in brackets indicates the default (d) or enabled (e) stream. - Enable the desired stream (here PHP 8.2).
This command creates a module profile that tellssudo dnf module enable php:8.2 -ydnfto prefer packages from the 8.2 stream. - Install the package from the enabled stream.
sudo dnf install php -ydnfwill resolve dependencies using the 8.2 module metadata. - Verify the installed version.
Expected output begins withphp -vPHP 8.2.
Expected Checks
- Confirm the module is enabled:
You should seednf module list --enabled | grep phpphp 8.2 [e](the[e]flag). - Check that the installed package originates from the CentOS Stream repository:
Expected line:rpm -qi php | grep VendorVendor: CentOS Stream. - Ensure the service (if applicable) runs without errors. For PHP‑FPM, for example:
Look forsudo systemctl status php-fpmactive (running).
Recovery Options
- Disable the stream (leaves the installed package but stops future updates from that stream):
sudo dnf module disable php:8.2 -y - Remove the package if you no longer need it:
sudo dnf remove php -y - Reset the module to its default state (clears any enabled/disabled state):
After resetting, you can enable a different stream (e.g.,sudo dnf module reset php -yphp:8.0) or let the default stream take effect. - Re‑install the default stream version** (optional):
Replacesudo dnf module enable php:8.0 -y sudo dnf install php -y8.0with whichever version is the default for your CentOS Stream release.
Limitations and Practical Tips
- Enabling a stream may replace or conflict with existing packages that depend on the previous version. Review
dnf repoquery --whatrequires phpbefore enabling. - Third‑party repositories (e.g., Remi, EPEL) can provide their own modules with the same name, causing unexpected version switches. Prioritize the CentOS Stream repo by ensuring it has a higher
priorityvalue in/etc/yum.repos.d/or by disabling conflicting third‑party modules withdnf module disable. - Application Streams only affect user‑space packages; kernel and core system components remain tied to the base CentOS Stream release.
By following the steps above you can safely install, verify, and, if needed, roll back a specific Application Stream version on CentOS Stream 9.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.