Upgrade PHP from 7.x to 8.x in RHEL8
Overview: This article helps linux user to upgrade PHP from lower version to latest version(8.2) in AlmaLinux, RockyLinux and Rhel.
1. How to upgrade PHP from 7.x to 8.2 in AlmaLinux 8.x, RockyLinux 8.x, RHEL 8.x?
Step 1(A): Enable EPEL and Remi repositories, run the below command:
root@server:~# dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
Step 1(B):. Install the PHP 8.2 repository
root@server:~# dnf module reset php -y
root@server:~# dnf module install php:remi-8.2 -y
Step 1(C): Install yum-util packages
root@server:~# yum install yum-utils -y
Step 1(D): Then run the update command
root@server:~# yum update
Step 1(E): To verify that PHP 8.2 has been successfully installed, check the version by running the following command:
root@server:~# php -v
2. How to upgrade PHP from 7.x to 8.2 in AlmaLinux 9.x, RockyLinux 9.x, RHEL 9.x?
Step 2(A): Install the EPEL repository. Run the followin command:
root@server:~# dnf install epel-release
Step 2(B): Install the Remi repository by executing the following command
root@server:~# dnf install http://rpms.remirepo.net/enterprise/remi-release-9.rpm
Step 2(C): Install the DNF utilities
root@server:~# dnf install dnf-utils
Step 2(D): Enable the PHP 8.2 Remi repository, run the following commands:
root@server:~# dnf module reset php
root@server:~# dnf module install php:remi-8.2
Step 2(E): Run the following command to install PHP 8.2:
root@server:~# dnf install php
Step 2(F): Check the PHP version by running the following command:
root@server:~# php -v
Related Articles:
Upgrade to php version 8.2 in OpenSUSE 15