In this tutorial, I will show you how to install PHP 8 on your CentOS/RHEL server.

Enable EPEL and Remi Repository 

dnf install
dnf install

Install PHP 8 

Get a list of available PHP module streams.

dnf module list php

Before installing you need to enable php:remi-8.0

dnf module enable php:remi-8.0

After that, you are able to install PHP 8

dnf install php

Verify installation 

php -v

I have httpd installed on my server, so I can verify PHP 8 installation in PHP sample file.

echo "<?php phpinfo();" > /var/www/html/info.php

Now open in browser http:/your-IP/info.php

That’s all, you have successfully installed PHP 8 on your CentOS/RHEL server