You are on page 1of 7

How To Install PHP 7.

4 on CentOS 7
By Josphat Mutai - July 12, 2021

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. x

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.
x

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 x

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

x
===========================================================================
========================================================================

Package Arch Version


Repository Size

===========================================================================
========================================================================

Installing:

php x86_64 7.4.0-


1.el7.remi remi-php74 3.4 M

php-cli x86_64 7.4.0-


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

centos-logos noarch 70.0.6-


3.el7.centos base 21 M

httpd x86_64 2.4.6-


90.el7.centos base 2.7 M

httpd-tools x86_64 2.4.6-


90.el7.centos base 91 k

mailcap noarch 2.1.41-


2.el7 base 31 k

php-common x86_64 7.4.0-


1.el7.remi remi-php74 1.1 M

php-json x86_64 7.4.0-


1.el7.remi remi-php74 68 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

Downloading packages:

(1/10): httpd-tools-2.4.6-90.el7.centos.x86_64.rpm
| 91 kB 00:00:00

(2/10): apr-1.4.8-5.el7.x86_64.rpm
| 103 kB 00:00:01

(3/10): mailcap-2.1.41-2.el7.noarch.rpm x
| 31 kB 00:00:00

(4/10): apr-util-1.5.2-6.el7.x86_64.rpm
| 92 kB 00:00:01

(5/10): httpd-2.4.6-90.el7.centos.x86_64.rpm | 2.7 MB 00:09


warning: /var/cache/yum/x86_64/7/remi-php74/packages/php-common-7.4.0-
1.el7.remi.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY

Public key for php-common-7.4.0-1.el7.remi.x86_64.rpm is not installed

(6/10): php-common-7.4.0-1.el7.remi.x86_64.rpm | 1.1 MB 00:09

(7/10): php-json-7.4.0-1.el7.remi.x86_64.rpm | 68 kB 00:01

(8/10): php-7.4.0-1.el7.remi.x86_64.rpm | 3.4 MB 00:13

(9/10): php-cli-7.4.0-1.el7.remi.x86_64.rpm | 5.1 MB 00:13

(10/10): centos-logos-70.0.6-3.el7.centos.noarch.rp | 21 MB 00:31

-------------------------------------------------------------------------

Total 1.1 MB/s | 34 MB 00:31

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Importing GPG key 0x00F97F56:

Userid : "Remi Collet <RPMS@FamilleCollet.com>"

Fingerprint: 1ee0 4cce 88a4 ae4a a29a 5df5 004e 6f47 00f9 7f56

Package : remi-release-7.7-1.el7.remi.noarch (installed)

From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Is this ok [y/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.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 7. Enjoy your PHP development/tests with x
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

Similar:

How To Install PHPUnit on CentOS / Fedora

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

Your support is our everlasting motivation,

that cup of coffee is what keeps us going!

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 x

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.

Josphat Mutai
https://computingforgeeks.com/

Founder of Computingforgeeks. Expertise in Virtualization, Cloud, Linux/UNIX Administration, Automation,Storage


Systems, Containers, Server Clustering e.t.c.


x

You might also like