Install the EPEL repository

  • CentOS 8
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
  • CentOS 7
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  • Fedora 33
dnf install https://rpms.remirepo.net/fedora/remi-release-33.rpm

Install the Remi repository

  • CentOS 8
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
  • CentOS 7
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
  • Fedora 33
dnf config-manager --set-enabled remi

Install the yum-utils package

  • CentOS 8
dnf install yum-utils
  • CentOS 7
yum install yum-utils

Enable the module stream for PHP 8.0:

  • CentOS 8
dnf module reset php
dnf module install php:remi-8.0
dnf update
  • CentOS 7
yum-config-manager --disable 'remi-php*'
yum-config-manager --enable   remi-php80
yum update
  • Fedora 33
dnf module reset php
dnf module install php:remi-8.0
dnf update

Install PHP 8

  • CentOS 8
dnf install php
  • CentOS 7
yum install php
  • Fedora 33
dnf install php

To verify the installed version, use the php command:

php -v

Conclusion

So that’s it on how to install PHP 8 on CentOS and RHEL.

if you like this post consider to support me