How to Install PHP 8.5 on Rocky Linux 9
PHP is a widely used open-source scripting language primarily designed for web development.
It can be embedded into HTML and works with many databases and frameworks.
In this guide, we will show you how to install PHP 8.5 on Rocky Linux 9.
Prerequisites
- A system running Rocky Linux 9
- Root access or a user with sudo privileges
Step 1: Connect to your Server
Connect to your server via SSH.
ssh root@your_server_ip
Replace your_server_ip with the IP address of your server.
Step 2: Update the System
Update the system packages.
dnf update -y
Step 3: Install Required Repositories
Install EPEL and Remi repositories.
dnf install epel-release -y
dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
Step 4: Reset PHP Module
Reset the default PHP module stream.
dnf module reset php -y
Step 5: Enable PHP 8.5 Repository
Enable the Remi PHP 8.5 repository.
dnf module enable php:remi-8.5 -y
Step 6: Install PHP 8.5
Install PHP 8.5 using the following command:
dnf install php php-cli php-common -y
Step 7: Install Common PHP Extensions
Install commonly used PHP extensions required by many applications.
dnf install php-mysqlnd php-gd php-xml php-mbstring php-curl php-zip php-intl -y
Step 8: Verify PHP Installation
Check the installed PHP version:
php -v
Example output:
PHP 8.5.4 (cli) (built: Mar 10 2026 23:15:23) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine
Zend Engine v4.5.4, Copyright (c) Zend Technologies
with Zend OPcache v8.5.4, Copyright (c), by Zend Technologies
Step 9: Install PHP-FPM (Optional)
If you are using Nginx or Apache with PHP-FPM, install PHP-FPM.
dnf install php-fpm -y
Enable and start the service:
systemctl enable php-fpm
systemctl start php-fpm
Check the service status:
systemctl status php-fpm
Conclusion
You have successfully installed PHP 8.5 on Rocky Linux 9.
You can now configure your web server (Apache or Nginx) to use PHP and start deploying PHP-based applications.
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