Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Download and Install PHP 7.4 on Centos 9/RHEL 9

October 28, 2022
in Blog, Linux
0
ADVERTISEMENT

Table of Contents

PHP 7.4 is a significant update of the PHP language that was officially released on November 28, 2019. This is the last version in the PHP 7 series that brings in arrow functions for cleaner one-liners, preloading for improved performance, typed properties in classes, improved type variances, spread operator in arrays and much more.

In this post, we’ll download and install PHP 7.4 on Centos 9/RHEL 9 servers.

# cat /etc/os-release
NAME="CentOS Stream"
VERSION="9"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="9"

Install PHP 7.4 on Centos 9/RHEL 9

1. First, SSH to your Centos 9/RHEL 9 server using a root account.

2. Update Centos 9/RHEL 9 and install the EPEL repository using the following commands:

sudo dnf -y update --refresh
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf -y install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-9.rpm
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm

Reference: List of php 7.4 repositories for Centos, RHEL and Fedora.

3. Verify the results of installing the REMI repository, see the contents of the yum.repos.d directory.

ls -l /etc/yum.repos.d	
# ls -l /etc/yum.repos.d
total 40
-rw-r--r--. 1 root root 4245 Sep  6 21:47 centos-addons.repo
-rw-r--r--. 1 root root 2600 Sep  6 21:47 centos.repo
-rw-r--r--. 1 root root 1519 Aug 10 20:11 epel-next.repo
-rw-r--r--. 1 root root 1621 Aug 10 20:11 epel-next-testing.repo
-rw-r--r--. 1 root root 1453 Aug 10 20:11 epel.repo
-rw-r--r--. 1 root root 1552 Aug 10 20:11 epel-testing.repo
-rw-r--r--. 1 root root 1825 May 23 21:42 remi-modular.repo
-rw-r--r--. 1 root root 1448 May 23 21:42 remi.repo
-rw-r--r--. 1 root root  810 May 23 21:42 remi-safe.repo

4. Enable REMI PHP 7.4 repository on your Centos 9/RHEL 9.

sudo dnf -y update --refresh
sudo dnf -y module enable php:remi-7.4

5. Install PHP 7.4 on Centos 9/RHEL 9 using the following commands:

sudo dnf -y update --refresh
sudo dnf -y install php php-cli
ADVERTISEMENT

Install PHP 7.4 Extensions

Next, install additional packages of PHP 7.4 using the following command:

sudo yum install php-xxx

Example, install required extensions for WordPress:

yum install php-fpm php-gd php-json php-mbstring php-mysqlnd php-xml php-xmlrpc php-opcache -y

Finally, when you check the installed PHP using the command , the current PHP version should be 7.4.

# php -v
PHP 7.4.32 (cli) (built: Sep 28 2022 09:09:55) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
To view enabled modules, run the command .
# php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
exif
...
sockets
sodium
SPL
...

[Zend Modules]
Zend OPcache

To get the list of installed php extensions, run the following command:

sudo dnf list installed | grep -i php
# sudo dnf list installed | grep -i php
gd3php.x86_64                        2.3.3-7.el7.remi               @remi-safe
oniguruma5php.x86_64                 6.9.8-1.el7.remi               @remi-safe
php.x86_64                           7.4.32-1.el7.remi              @remi-php74
php-cli.x86_64                       7.4.32-1.el7.remi              @remi-php74
php-common.x86_64                    7.4.32-1.el7.remi              @remi-php74
php-fpm.x86_64                       7.4.32-1.el7.remi              @remi-php74
php-gd.x86_64                        7.4.32-1.el7.remi              @remi-php74
...
ADVERTISEMENT

Alternatively, you can create a bash script to install PHP 7.4 on CentOS 9/RHEL 9 as follows:

#/bin/sh
###Update the CentOS 9 System
sudo dnf -y update --refresh
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf -y install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-9.rpm
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm

###Enable REMI PHP repository
sudo dnf -y update --refresh
sudo dnf -y module enable php:remi-7.4
sudo dnf -y update --refresh

###Install PHP 7.4 on CentOS 9/RHEL 9
sudo dnf -y install php php-cli
yum install php-fpm php-gd php-json php-mbstring php-mysqlnd php-xml php-xmlrpc php-opcache -y
5/5 - (1 vote)
Previous Post

Script: How to Install LEMP Stack on CentOS 9/RHEL 9

Next Post

Module Yaml Error Unexpected Key in Data Static_Context

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory