How to Install PHP 7.4 on CentOS 8 / RHEL 8

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

In this howto we'll go over the installation process of PHP 7.4 on CentOS 8 and RHEL 8


1- Minimal Install of CentOS 8 / RHEL 8

2- sudo or root privileges


Step 1: Enable EPEL and Remi Repository

The default installation of CentOS 8 and RHEL 8 includes PHP 7.2 and 7.3, but to install PHP 7.4 at the time of writting this article it is required to configure EPEL and REMI repositories, to do that we should run the following commands:


[[email protected] ~]# sudo dnf install epel-release -y
[[email protected] ~]# sudo dnf install -y


Once we have completed this process we'll go ahead and run the following dnf command to see the available PHP versions:


[[email protected] ~]# sudo dnf module list php



Here we can see that the default PHP version is 7.2 under CentOS-8 Appstream, we can also see that 7.4 shows under the Remi's Repository, so we'll go head and enable it so that when we install php 7.4 with the dnf command it will actually pull it from the remi modular repo.


Step 2: Enable latest PHP Module Stream (remi-7.4):

[[email protected] ~]# sudo dnf module enable php:remi-7.4



we confirm with "y" and move onto step 3.


Step 3: Install and Verify PHP

[[email protected] ~]# sudo dnf install php php-cli php-common -y





Now we can check on the version of PHP we just installed by running php -v:

[[email protected] ~]# php -v

PHP 7.4.5 (cli) (built: Apr 14 2020 12:54:33) ( NTS )

Copyright (c) The PHP Group

Zend Engine v3.4.0, Copyright (c) Zend Technologies

    with Zend OPcache v7.4.5, Copyright (c), by Zend Technologies


That's it, we have PHP 7.4 now installed on this server.

  • php 7.4, centos 8, rhel 8
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

ownCloud Auto Install Script on Debian 7

Here is an easy way to install ownCloud on Debian 7 with a script, but first, for those who...

NGINX – Allow access only to certain IPs

Nginx has a nice module that not many people know about, it basically enables us...

How to configure NTP client in CentOS

What's NTP? NTP stands for Network Time Protocol, and it is an Internet protocol used to...

Initial Server Setup on CentOS 6

Here are some recommendations to setup your VPS or server when you first get it, some of these...

How To Install nginx on CentOS

What is NGINX? Nginx (pronounced "engine-x") is an open source reverse proxy server for HTTP,...