Welcome to today’s guide on how to install PHP 7.4 on CentOS 8 / RHEL 8 Linux system. The PHP Version 7.4.0 has been released for the developers, and users interested in running it in production. The official release date for GA was November 28, 2019.

Follow the steps below to Install PHP 7.4 on CentOS 8 / RHEL 8.

Step 1: Add EPEL and REMI Repository

EPEL and REMI repositories are the main requirements for this installation. Add them to the system by running these commands:

sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Step 2: Install PHP 7.4 on CentOS 8 / RHEL 8

Once the repositories are added, We can enable PHP 7.4 Remi module and install PHP 7.4 on CentOS 8 / RHEL 8.

sudo dnf -y install dnf-utils

Enable the module stream for PHP 7.4 on CentOS 8 / RHEL 8.

sudo dnf module install php:remi-7.4

Accept installation prompt.

Updating Subscription Management repositories.
Last metadata expiration check: 0:00:24 ago on Mon 16 Sep 2019 09:36:21 AM EDT.
Dependencies resolved.
 Package                     Arch              Version                                           Repository                                   Size
Installing group/module packages:
 php-cli                     x86_64            7.4.0~RC1-1.el8.remi                              remi-modular                                4.6 M
 php-common                  x86_64            7.4.0~RC1-1.el8.remi                              remi-modular                                1.2 M
 php-fpm                     x86_64            7.4.0~RC1-1.el8.remi                              remi-modular                                1.6 M
 php-json                    x86_64            7.4.0~RC1-1.el8.remi                              remi-modular                                 71 k
 php-mbstring                x86_64            7.4.0~RC1-1.el8.remi                              remi-modular                                524 k
 php-xml                     x86_64            7.4.0~RC1-1.el8.remi                              remi-modular                                211 k
Installing dependencies:
 nginx-filesystem            noarch            1:1.14.1-8.module+el8+2505+fe936cef               rhel-8-for-x86_64-appstream-rpms             24 k
 oniguruma                   x86_64            6.8.2-1.el8                                       rhel-8-for-x86_64-appstream-rpms            188 k
 httpd-filesystem            noarch            2.4.37-11.module+el8.0.0+2969+90015743            rhel-8-for-x86_64-appstream-rpms             34 k
 libxslt                     x86_64            1.1.32-3.el8                                      rhel-8-for-x86_64-baseos-rpms               249 k
Installing module profiles:
Enabling module streams:
 httpd                                         2.4                                                                                                
 nginx                                         1.14                                                                                               
 php                                           remi-7.4                                                                                           

Transaction Summary
Install  10 Packages

Total download size: 8.6 M
Installed size: 43 M
Is this ok [y/N]: y

Use the next command to install additional packages:

sudo dnf update
sudo yum install php-xxx

The current PHP version should be 7.4.

$ php -v
PHP 7.4.0 (cli) (built: Nov 26 2019 20:13:36) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

To view enabled modules, run:

$ php --modules

You have successfully installed PHP 7.4 on CentOS 8 / RHEL 8.


Install PHP 7.4 on Ubuntu

How To Install PHP 7.4 on Fedora

How To Install PHP 7.4 on CentOS 7

How To Install PHP 7.4 on Debian

How To Install PHPUnit on CentOS / Fedora