How to Install PHP 8.2 on Rocky Linux 10

Pre-requisites

Requirements

  • A system with Rocky Linux 10 installed and running
  • Root access to the system

Add EPEL and Remi Repositories

Install EPEL (Extra Packages for Enterprise Linux) and the Remi repository:

dnf install epel-release -y

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

Install dnf-utils

This tool allows you to manage DNF module streams:

dnf install dnf-utils -y

Enable PHP 8.2 Remi Module

Reset any existing PHP module streams:

dnf module reset php -y

Enable the Remi repository for PHP 8.2:

dnf module enable php:remi-8.2 -y

Install PHP 8.2 Core Packages

Install PHP and common required modules:

dnf install php php-cli php-common php-fpm php-mbstring php-xml -y

You may see output similar to this:

Installed:
  php-8.2.x.x.el10.remi.x86_64
  php-cli-8.2.x.x.el10.remi.x86_64
  php-common-8.2.x.x.el10.remi.x86_64
  php-fpm-8.2.x.x.el10.remi.x86_64
  php-mbstring-8.2.x.x.el10.remi.x86_64
  php-xml-8.2.x.x.el10.remi.x86_64

Run System Update

Update all packages to ensure compatibility:

dnf update -y

Verify PHP Version

Check the installed PHP version:

php -v

Output:

PHP 8.2.28 (cli) (built: Mar 11 2025 17:58:12) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c)

Install Additional PHP Modules (Optional)

If you're using WordPress, Drupal, Joomla, or other CMS platforms, install additional modules:

dnf install -y php-{cli,gd,mysqlnd,mbstring,json,common,dba,dbg,devel,embedded,enchant,bcmath,gmp,intl,ldap,odbc,pdo,opcache,pear,pgsql,process,snmp,soap,xml}

Conclusion

PHP 8.2 is now successfully installed on Rocky Linux 10. You can now use it to run or develop web applications. For further help or technical issues, reach out via Support Ticket.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS