This is a short guide on how to Install PHP 7.4 on CentOS 7. The PHP Version 7.4.0RC1 has been released in stabilization phase for the developers, and for users to test. This is not recommended to be run in Production, until the stable version of PHP 7.4 is made available to the general public. The expected official release date is November 28, 2019.

For RHEL 8 / CentOS 8: How To Install PHP 7.4 on CentOS 8 / RHEL 8

PHP 7.4 comes with a remarkable amount of new features. This version is RPM are available in the remi-php74 repository for Fedora  29 and Enterprise Linux  7 (RHEL, CentOS) and as Software Collection in the remi-safe repository (or remi for Fedora).

Step 1: Add EPEL and REMI Repository

Run the commands below to add required repositories.

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

Step 2: Install PHP 7.4 on CentOS 7

We can now enable PHP 7.4 Remi repository and install PHP 7.4 on CentOS 7.

sudo yum -y install yum-utils
sudo yum-config-manager --enable remi-php74

Install PHP 7.4 on CentOS 7.

sudo yum update
sudo yum install php php-cli

Accept installation prompt.

Dependencies Resolved

===================================================================================================================================================
 Package                           Arch                        Version                                       Repository                       Size
===================================================================================================================================================
Installing:
 php                               x86_64                      7.4.0~RC1-1.el7.remi                          remi-php74                      3.4 M
 php-cli                           x86_64                      7.4.0~RC1-1.el7.remi                          remi-php74                      5.1 M
Installing for dependencies:
 apr                               x86_64                      1.4.8-3.el7_4.1                               base                            103 k
 apr-util                          x86_64                      1.5.2-6.el7                                   base                             92 k
 centos-logos                      noarch                      70.0.6-3.el7.centos                           base                             21 M
 httpd                             x86_64                      2.4.6-89.el7.centos.1                         updates                         2.7 M
 httpd-tools                       x86_64                      2.4.6-89.el7.centos.1                         updates                          91 k
 mailcap                           noarch                      2.1.41-2.el7                                  base                             31 k
 php-common                        x86_64                      7.4.0~RC1-1.el7.remi                          remi-php74                      1.1 M
 php-json                          x86_64                      7.4.0~RC1-1.el7.remi                          remi-php74                       66 k

Transaction Summary
===================================================================================================================================================
Install  2 Packages (+8 Dependent packages)

Total download size: 34 M
Installed size: 73 M
Is this ok [y/d/N]: y

Use the next command to install additional packages:

sudo yum install php-xxx

Example:

sudo yum install php  php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

The current PHP version should be 7.4.

$ php -v
PHP 7.4.0RC1 (cli) (built: Sep  3 2019 07:45:03) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies

To view enabled modules, run:

$ php --modules

You have successfully installed PHP 7.4 on CentOS 7. Enjoy your PHP development/tests with this release and don’t forget to provide feedback to the Development team.

PHP 7.4 installation on other Linux systems:

How To Install PHP 7.4 on Fedora

How To Install PHP 7.4 on Debian 10 / Debian 9

How To Install PHP 7.4 on CentOS 8 / RHEL 8

How To Install PHP 7.4 on Ubuntu

Similar:

How To Install PHPUnit on CentOS / Fedora

How to hide X-Powered-By / X-CF-Powered-By PHP headers in Nginx