Installing PHP on Rocky Linux 10 (released in June 2025) is more straightforward than previous versions because PHP 8.3 is included as the default version in the standard appstream repository.
There are two ways to install it: using the default system repositories (recommended for stability) or using the Remi repository (for the absolute latest versions like PHP 8.4).
Option 1: Install Default PHP (PHP 8.3)
Rocky Linux 10 provides PHP 8.3 out of the box. This is the simplest method and is recommended for most users.
Before you begin, Update your system:
Update your system:
$ sudo dnf update -y
PHP is available in the default Rocky Linux repositories. Install it using the dnf package manager:
dnf
$ sudo dnf install php php-cli php-fpm php-curl php-mysqlnd php-gd php-opcache php-zip php-intl php-common php-mbstring php-xml -y
After installation, PHP files are located in the following directories:
/usr/bin/php
/usr/local/bin/php
If you are using a web server like Nginx or Apache, you need the FastCGI Process Manager (FPM).
$ sudo systemctl enable --now php-fpm
$ php -v
If you need a newer version than what is in the official repositories, you can use the Remi repository:
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm -y
$ sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-10.rpm -y
Reset the default PHP module:
$ sudo dnf module reset php -y
Enable the desired PHP version (e.g., 8.4):
$ sudo dnf module enable php:remi-8.4 -y
Important Post-Installation Steps active (running).
Test PHP Processing
To verify that your web server is correctly processing PHP, create a test file in your web root (usually /var/www/html/):
$ echo '?php phpinfo(); ?>' | sudo tee /var/www/html/info.php
Visit http://your-server-ip/info.php in your browser. You should see a detailed page about your PHP environment.
Depending on your application (WordPress, Laravel, etc.), you might need specific modules:
RELEASE DATE: Tuesday, April 23, 2024Tuesday, March 26, 2024
For Intel and AMD x86_64 systems
Absolute Linux BETALive ISOiso4.3 GiB
Once you have downloaded an image, be sure to verify it for both security and integrity.
By calculating the image’s checksum on your own computer and comparing it to the original checksum, you can verify the image has not been tampered with or corrupted. Images are also gpg signed with Fedora keys to demonstrate their integrity.
Click the verify button to download the checksum file for your downloaded image.
Import Linuxrpms's GPG key(s)
curl -O https://linuxrpms.com/linuxrpms-gpg.pub
You can verify the details of the GPG key(s) here.
Verify the checksum file is valid
gpgv --keyring ./linuxrpms-gpg.pub absolutelinux-*-CHECKSUM
Verify the checksum matches
sha256sum -c absolutelinux-*-CHECKSUM
If the output states that the file is valid, then it's ready to use!
By clicking on and downloading Rocky Linux, you agree to comply with the US Export Control Policy.