How to Install PHP 7.4 on CentOS 8

PHP, a recursive acronym for PHP Hypertext Preprocessor, is a popular server-side scripting language used in web development for creating powerful and dynamic websites.

In this article, you will learn how to install PHP 7.4 on CentOS 8 Linux.

Step 1: Add EPEL and Remi Repositories

To get started, you need to add EPEL & Remi repository from where you will be able to install PHP 7.4 on CentOS 8 Linux.

To install and enable the EPEL repository on CentOS 8, execute the following dnf command.

# dnf install
Install EPEL Repo on CentOS 8

Install EPEL Repo on CentOS 8

To confirm the presence of the EPEL repository, run the following rpm command.

# rpm -qa | grep epel
Confirm EPEL Installation

Confirm EPEL Installation

Next, run the command below to add the Remi repository.

# dnf install
Install Remi Repo on CentOS 8

Install Remi Repo on CentOS 8

Once again, to verify the existence of the Remi repository, run the command.

# rpm -qa | grep remi
Confirm Remi Repo Installation

Confirm Remi Repo Installation

Step 2: Install PHP 7.4 on CentOS 8

Upon successful addition of EPEL and Remi repositories, execute the command below to get a list of available PHP module streams.

# dnf module list php
List PHP Modules

List PHP Modules

From the output above, remi-7.4 is the latest PHP stream, and therefore we are going to enable the module stream as shown below.

# dnf module enable php:remi-7.4
Enable PHP Remi Stream

Enable PHP Remi Stream

Once the PHP remi-7.4 module has been enabled, you can then proceed and install PHP using the command below. This will also install a host of other packages such as Apache and Nginx modules.

# dnf install php php-cli php-common
Install PHP on CentOS 8

Install PHP on CentOS 8

To check the version of PHP installed, run the command.

# php -v
Verify PHP Installed Version

Verify PHP Installed Version

From the output, we can clearly see that we have installed PHP version 7.4! You can now proceed to test and deploy your applications using PHP. And that’s just about it for now. We do hope you found this guide helpful.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

James Kiarie

This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

2 Responses

  1. James Kiarie says:

    Thank you, Xe tải tốt. We’re glad that this article was informative and valuable to you.

  2. Xe tải tốt says:

    Thank you! it works for me and I bookmarked this page…

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.