REMI and EPEL are the most popular repositories contains latest RPM packages for installation. It also contains the PHP 8 RPM packages to be install on CentOS/RHEL 8 systems. This article will describe you to how to install PHP 8 on CentOS 8 or RHEL 8 Linux system.

Before we Begin

Login to the CentOS 8 system with sudo privileged account. Optionally, you can upgrade the current packages on your system by executing command.

Step 1 – Enable PHP Repository

The CentOS/RHEL default repositories don’t contain latest PHP 8 packages. In order to install PHP 8 on CentOS 8 system, enable EPEL and REMI yum repositories on your system. Open a terminal and execute below commands to configure REMI and EPEL repositories: Once you installed both the above packages, Use dnf command line tool to active php:remi-8.0 repository, which contains PHP 8 packages. Verify the active repository for the php packages on your system. Make sure the remi-8.0 steam is active for the php packages. It will have [e] just after the repository name. See the below screenshot:

Step 2 – Installing PHP 8 on CentOS

Your system is ready for the PHP 8 installation. Run the following command from terminal. Press ‘y’ for any confirmation prompted during installation. Once the installation succeeded, execute the below command to view installed PHP version on your syste.

At this stage, you have successfully install PHP 8 on CentOS 8 and RHEL 8 systems.

Step 3 – Install Apache with PHP 8 on CentOS

This is the optional step for you, if you just need PHP CLI to running php scripts. But in most cases, we use Apache for deploying PHP based web application. Just execute the following command to Apache web server on your system. Now, verity that Apache is read to serve php files over the web. Lets create php info file on your CentOS server. The default virtulhost uses /var/www/html as document root. So create a file under this directory: Next access info.php file using the server ip address as below:

Step 4 – Installing PHP Extension

Generally the web application depends on multiple PHP extension. A PHP extension is a specially formed library for the specific tasks. View the available PHP extensions, type: Now, install all the required PHP extension for your application. Use -m option to view currently enabled php extensions.

Conclusion

This tutorial helped you to install PHP 8.0 including the required extension on CentOS/RHEL 8 Linux system.

How to Install PHP 8 on CentOS RHEL 8   TecAdmin - 34How to Install PHP 8 on CentOS RHEL 8   TecAdmin - 83How to Install PHP 8 on CentOS RHEL 8   TecAdmin - 94