Setup Yum Repository

For this tutorial, we will use the REMI repository for PHP installation on CentOS 8 Linux system. So add the REMI repository on your system using the following command. REMI repository contains the PHP packages. You just need to enable the correct repo for the required PHP version. Find out the available repository for the different PHP versions. The above output shows that the default AppStream contains PHP 7.2 and REMI contains PHP 7.2, 7.3 and 7.4 packages. Let’s start with the PHP installation.

Install PHP on CentOS 8

At this point, your system is ready for PHP installation. PHP 7.4 is the latest stable release available for the installation. So you can use the latest version for the production servers. You can use other PHP versions as per your requirements.

Install PHP 7.4

Install PHP 7.3

Install PHP 7.2

Install PHP Modules

You may also require additional PHP modules to run your PHP application.

Test PHP Version

After successful installation use the following command to test the installed PHP version.