Install Latest Version of PHP on CentOS 8 and 7

Created: Wed 22 Mar 2023 Updated: 1 year, 4 months ago

article-featured-image

CentOS is great. I have to admit that all those SELinux enforcement and other security features are just amazing. That's what makes It Server Choice Distributions. But, If you are not using CentOS Subscription-based service then the free version does include all the packages but these packages are too outdated. For some packages, the available version is already depreciated.

If you are using CentOS 8/7 as a web server, then you sure want updated packages. And one of the packages is Php, which is mainly used for WordPress. In this post, you'll get to know the process of installing the Latest version of the Php package on your CentOS 8 or CentoOS 7.


Latest version of PHP for CentOS 8

As of now, the Php version in CentOS official repository is 5.x but Php has released 8.x already, which is not available in CentOS official repository (non-Subscription-based). To install the latest version of Php follow the below steps in sequence:
$sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
$sudo yum module list php
$module enable php:remi-8.0
This process will install and configure the system to use epel and remi repository on CentOS 8, which will provide the latest version of PHP. Use sudo yum install php to install version 8.0 of PHP.

Usage of epel repository

This package will install and enable epel repository in the system that we can further use to install additional packages, packages that are not available in the official CentOS repository.

EPEL stands for Extra Packages for Enterprise Linux. It included additional packages that are usually available in Redhat Linux but not in CentOS.


Usage of remi repository

Remi is a third-party repository that is used in CentOS or other Linux distributions. Remi provides up-to-date packages of Php along with other web-related tools and software such as MySQL. This package will install and configure the system to use remi repository.


Latest version of PHP for CentOS 7

The process of enabling epel and remi in CentOS 7 is slightly different than in CentOS 8. Run the following commands in the same sequence as listed to complete the process.
$sudo yum install epel-release
$sudo rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$sudo yum install yum-utils
$sudo yum-config-manager --enable remi-php80
$sudo yum install php
This process will install and configure the system to use epel and remi repository on CentOS 7, which will provide the latest version of PHP. Use sudo yum install php to install version 8.0 of PHP.
PHP 8.0 for CentOS 8 or CentOS 7
protocolten-admin

Author: Harpreet Singh
Server Administrator

POST CATEGORY
  1. Linux
  2. Cloud
  3. Programming
Suggested Posts:
CYBER SECURITY post image
picoCTF Web Exploitation Challenges and Solutions

picoCTF is an open-source project. It's an enhanced platform for education and organizing competitions …

WINDOWS post image
Create environment variables and paths in windows

Windows environment variables and paths are essential components of the operating system, acting as pointers …

LINUX post image
Configure FastAPI with Nginx and uvicorn

This article is all about the configuration of FastAPI with uvicorn and then reverse …

LINUX post image
Secure Apache against DDoS attacks using mod evasive

mod_evasive is an Apache web server module that helps protect the server against some types …

PROGRAMMING post image
Fastest method to list all Prime Numbers in Python

While writing code, most developers prefer to code less. And up to some point, …

Sign up or Login to post comment.

Sign up Login

Comments (0)