PHP is a recursive initials PHP Hypertext Preprocessor acronym, is a popular server-side scripting language for Web developers to create powerful and dynamic website.
Step 1: Add EPEL and Remi repository
First, you need to add EPEL & Remi repository, from which you can install PHP 7.4 on CentOS 8 Linux.
To install and enable EPEL repository on CentOS 8, execute the following command dnf.
To confirm the presence of EPEL repository, run the following command rpm.
Next, run the following command to add Remi repository.
Again, in order to verify the existence of Remi repository, run the command.
Step 2: PHP 7.4 installed on CentOS 8
After successfully added EPEL and Remi repository, execute the following command to get a list of available PHP modules stream.
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
From the above output, remi-7.4 is the latest PHP streams, therefore the flow module, as shown below will be enabled.
Transaction Summary
================================================ ================================
sure? [y / N]: y
is completed!
Switching module streams does not alter installed packages (see 'module enable' in dnf(8) for details)
When you enable PHP remi-7.4 module, you can use the following command to continue and install PHP. This will also install many other packages such as Apache and Nginx module.
To check the version of PHP installed, run the command.
From the output, we can clearly see that we have already installed PHP version 7.4! Now, you can continue to use PHP to test and deploy applications. Now that's it. We hope this guide to help you.