How to Install PHP 7.4 in CentOS 7

To add EPEL and REMI Repository.

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

To install yum utilities.

yum -y install yum-utils

To enable 7.4 Remi repository.

yum-config-manager --enable remi-php74

TO Install PHP 7.4.

To install any remaning updates.

How to Install PHP 7.4 in CentOS 7

To add EPEL and REMI Repository.

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

To install yum utilities.

yum -y install yum-utils

To enable 7.4 Remi repository.

yum-config-manager --enable remi-php74

TO Install PHP 7.4.

To install any remaining updates.

yum update

To install PHP.

yum install php php-cli

Output:

================================================================================
 Package          Arch        Version                     Repository       Size
================================================================================
Installing:
 php              x86_64      7.4.6-1.el7.remi            remi-php74      3.4 M
 php-cli          x86_64      7.4.6-1.el7.remi            remi-php74      5.1 M
Installing for dependencies:
 apr              x86_64      1.4.8-5.el7                 base            103 k
 apr-util         x86_64      1.5.2-6.el7                 base             92 k
 httpd            x86_64      2.4.6-93.el7.centos         base            2.7 M
 httpd-tools      x86_64      2.4.6-93.el7.centos         base             92 k
 libsodium        x86_64      1.0.18-1.el7                epel            147 k
 mailcap          noarch      2.1.41-2.el7                base             31 k
 php-common       x86_64      7.4.6-1.el7.remi            remi-php74      1.2 M
 php-json         x86_64      7.4.6-1.el7.remi            remi-php74       69 k
 php-sodium       x86_64      7.4.6-1.el7.remi            remi-php74       81 k

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

Total download size: 13 M
Installed size: 52 M
Is this ok [y/d/N]: y

NOTE: It will prompt for permission type y and press Enter to proceed with the installation.

Check PHP Version.

php -v

Output:

[root@vps ~]# php -v
PHP 7.4.6 (cli) (built: May 12 2020 08:09:15) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

This concludes our topic of installing PHP 7.4 on the CentOS 7 system.