Programming

Easy to Install PHP 7.4 on CentOS 8

In this tutorial, we will show you how it is easy to install PHP 7.4 on CentOS 8.

PHP is a popular general-purpose scripting language that is especially suited to web development. Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.

Let’s start with the installation process.

1. Install Remi repository

By default, CentOS 8 install PHP 7.2 and PHP 7.3. In order to install PHP 7.4 first, we need to install Remi repository,  which will provide the PHP 7.4 packages we want to install along with some handy package management utilities.

# dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y

2. Next, take a look at the available PHP modules by running.

# dnf module list php

Output:

Extra Packages for Enterprise Linux Modular 8 – x86_64 208 kB/s | 117 kB 00:00
Extra Packages for Enterprise Linux 8 – x86_64 3.8 MB/s | 6.6 MB 00:01
Remi’s Modular repository for Enterprise Linux 8 – x86_64 456 kB/s | 567 kB 00:01
Safe Remi’s RPM repository for Enterprise Linux 8 – x86_64 1.1 MB/s | 1.5 MB 00:01
CentOS-8 – AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common, devel, minimal PHP scripting language
Remi’s Modular repository for Enterprise Linux 8 – x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Next, in order to enable the PHP remi-7.4 stream run the following dnf commands.

# dnf module reset php -y

# dnf module enable php:remi-7.4 -y

3. Install PHP 7.4

# dnf install php -y

4. Verify the installation

To verify the installation check the version of the PHP using following command:

# php -v

Output will similar like this:

PHP 7.4.6 (cli) (built: Oct 12 2020 08:09:15) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies

We have successfully install PHP 7.4.

In this tutorial we have shown you how it is easy to install PHP 7.4 on CentOS 8.

Checkout our dedicated server plans.

Related Articles