
Step 1: List Available PHP Modules
To see a list of available PHP modules, run the following command:
dnf module list | grep php
Step 2: Update Your System
Before proceeding, it’s a good practice to update your system:
sudo yum update -y
Step 3: Reboot Your System
After updates, it’s recommended to reboot your system to ensure changes take effect:
sudo reboot
Step 4: Install EPEL Repository
Install the EPEL (Extra Packages for Enterprise Linux) repository:
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Step 5: Install REMI Repository
Install the REMI repository:
sudo dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
Step 6: Update DNF Cache
Update DNF cache to refresh package lists:
sudo dnf makecache -y
Step 7: Reset Default PHP Module
Reset the default PHP module:
sudo dnf module reset php -y
Step 8: Enable PHP 8.2 from REMI Repository
Install PHP 8.2 from the REMI repository:
sudo dnf module install php:remi-8.2 sudo dnf -y install php
Step 9: Check PHP Version
To confirm the PHP version, run:
php -v
Step 10: Install PHP Modules
Install various PHP modules by running:
sudo dnf install php-{ctype,dom,fileinfo,gd,json,openssl,posix,session,simplexml,xmlreader,xmlwriter,zlib,common,pear,cgi,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap,bz2,intl,ldap,smbclient,ftp,imap,gmp,exif,imagick,pcntl,phar}
This guide outlines the steps to update PHP and install various PHP modules. Be sure to adapt the instructions to your specific Linux distribution or version if necessary.
Leave a Reply