How to Install PHP 8 on CentOS 8 – Quick Guide 2021

This is a quick guide on how to install PHP 8 in CentOS. The php8 package was released as part of the php7 release and provides benefits such as better performance, improved stability, and support for new language features.

Update your system and install all updates

Update the packages first. This step is optional and can take up to 5 mins 🙂

sudo dnf update -y

Install the EPEL repository Add the DNF repo for PHP 8

Right off the bat, you need to enable EPEL on your system. RHEL is missing some packages that are not present by default for Fedora and CentOS because of an effort from this team called Extra Packages For Enterprise Linux (EPEL).

sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

The Remi repository is a third-party repository that provides PHP versions for RedHat Enterprise Linux. To install the Remi Repository, run the following command

sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Enable the PHP 8 module

All of the functions, features, and add-ons that PHP has to offer can be enumerated by simply running a few commands. To do so you should first see the PHP module list

sudo dnf module list php

Right at the bottom, be sure to notice our remi-8.0 php module.

We need to enable this module before installing PHP 8.0 on your system! To do that, execute:

sudo dnf module enable php:remi-8.0 -y

Install PHP 8.0 for Apache to better manage your web server and its load effectively.

sudo dnf install php php-cli php-common php-mysqlnd php-mbstring php-xml

See the Installed PHP version by running this command

php -v

Add a phpinfo file to see the PHP version

sudo vi /var/www/html/index.php
<?php 
phpinfo();

restart the Apache server by running this command

sudo systemctl restart httpd

I have created a video to illustrate the process.

Conclusion

Conclusion paragraph: PHP is an open-source server-side scripting language that has been around for over 20 years. It was originally designed as a simple and powerful way to add dynamic content, like forms, widgets, and animations to web pages without the need for more complicated languages such as Perl or Python.

Over time it’s become one of the most popular programming languages on the internet today. In this tutorial, we’ll show you how to install PHP 8 on CentOS 8 with Apache 2 by using yum command-line tools in terminal mode. If you have any questions about these steps feel free to leave them below and I will be happy to answer them!

Related Articles

PHP 8 in Amazon Linux 2

Gadget for Developers

Atiqur Rahman

I am MD. Atiqur Rahman graduated from BUET and is an AWS-certified solutions architect. I have successfully achieved 6 certifications from AWS including Cloud Practitioner, Solutions Architect, SysOps Administrator, and Developer Associate. I have more than 8 years of working experience as a DevOps engineer designing complex SAAS applications.

Leave a Reply