How to update PHP version 7.2 to 7.4 in CentOS 7?

This is a short guide on how to Install PHP 7.4 on CentOS 7 Linux system. The PHP Version 7.4.0 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
sudo yum -y install

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
 php                                            x86_64                                   7.4.30-1.el7.remi                                         remi-php74                                   3.4 M
 php-cli                                        x86_64                                   7.4.30-1.el7.remi                                         remi-php74                                   5.2 M
Installing for dependencies:
 apr                                            x86_64                                   1.4.8-7.el7                                               base                                         104 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-97.el7.centos.5                                     updates                                      2.7 M
 httpd-tools                                    x86_64                                   2.4.6-97.el7.centos.5                                     updates                                       94 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.30-1.el7.remi                                         remi-php74                                   1.2 M
 php-json                                       x86_64                                   7.4.30-1.el7.remi                                         remi-php74                                    74 k
 php-sodium                                     x86_64                                   7.4.30-1.el7.remi                                         remi-php74                                    85 k

Transaction Summary
Install  2 Packages (+10 Dependent packages)

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

Also agree to import GPG keys:

Total                                                                                                                                                                  31 MB/s |  34 MB  00:00:01
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Importing GPG key 0x00F97F56:
 Userid     : "Remi Collet <[email protected]>"
 Fingerprint: 1ee0 4cce 88a4 ae4a a29a 5df5 004e 6f47 00f9 7f56
 Package    : remi-release-7.9-4.el7.remi.noarch (@/remi-release-7)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Is this ok [y/N]: y
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <[email protected]>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-14.noarch (@/epel-release-latest-7.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y

Step 3: Install PHP 7.4 Extensions

Use the next command to install additional packages:

sudo yum install php-xxx


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.30 (cli) (built: Jun  7 2022 08:38:19) ( 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 7. Enjoy your PHP development/tests with this release and don’t forget to provide feedback to the Development team.

Video Courses To Learn PHP Web Programming:

  • The Complete Web Developer Course
  • PHP for Beginners – Become a PHP Master – CMS Project
  • The Complete PHP Full Stack Web Developer Bootcamp
  • PHP with Laravel for beginners – Become a Master in Laravel
  • PHP OOP: Object Oriented Programming for beginners + Project

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


How To Install PHPUnit on CentOS / Fedora

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


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

How to update PHP version in CentOS 7?

How to upgrade PHP in centos 7?.
Turn on EPEL repo. [email protected]:~# yum install epel-release..
Turn on remi-repo. [email protected]:~# yum install
Install yum-util packages. ... .
Enable remi repo as per the desired php version. ... .
Finally install php7.X..

How to upgrade PHP 7.2 to 7.4 CentOS 8?

How To Upgrade PHP 7.2 to PHP 7.4 on CentOS 8 or RHEL 8.
Step 1: Add EPEL and REMI Repository. sudo yum -y install https://dl. ... .
Step 2: Install PHP 7.4 on CentOS 8 / RHEL 8. sudo dnf -y install dnf-utils..
Step 3: Enable the module stream for PHP 7.4 on CentOS 8 / RHEL 8. ... .
Step 4: Install additional packages..

How to install PHP 7.5 on CentOS 7?

How To Install PHP 7, 7.2 & 7.3 On CentOS 7.
Step 1: Choose PHP Version to Install..
Step 2: Enable Additional Software Repositories..
Step 3: Enable Repository For PHP Version..
Step 4: Install PHP and its Dependencies..
Step 5: PHP Modules..
Step 6: Verify PHP Version..
Optional: Install PHP 7.3..

How to upgrade PHP version from 5.4 to 7.4 in CentOS 7?

Upgrade to PHP 7.
sudo yum install ... .
sudo yum remove php-common mod_php php-cli. ... .
sudo yum update. ... .
sudo yum install php70u php70u-pdo php70u-mysqlnd php70u-opcache php70u-xml php70u-gd php70u-devel php70u-mysql. ... .
sudo systemctl restart httpd..