Skip to content

Did you know?

On RHEL 9, a plain "dnf install php" still installs PHP 8.0, which is end of life.

Enable a module stream first: AppStream offers PHP 8.1 to 8.4 as modules.

  • Packages
  • Applies to RHEL 9, Rocky Linux 9, AlmaLinux 9
  • Last checked

Explained

RHEL 9 and its rebuilds (Rocky Linux, AlmaLinux, CentOS Stream) keep PHP 8.0 as the non-modular default in AppStream. Upstream support for PHP 8.0 ended in November 2023, yet that is what you get if you simply run sudo dnf install php.

Newer branches are there too, as module streams. List them:

dnf module list php

On a current RHEL 9 system the list includes the streams 8.1, 8.2, 8.3 and 8.4. Enable one before installing, and dnf installs that version instead:

sudo dnf module enable php:8.4 -y
sudo dnf install php php-cli php-fpm -y

Already installed 8.0 by accident? Enable the stream and run sudo dnf distro-sync -y to move the packages to the new version. For PHP 8.5, use the Remi repository’s php:remi-8.5 stream.

Learn more

← All tech tips · Suggest a fix

Back to top