Site icon DesignLinux

How to Install Latest PHP 8.0 on Rocky Linux 8

PHP 8.0 was officially released back on November 26, 2020, and is a major update to PHP 7.4. At the time of publishing this guide, the latest stable release is PHP 8.0.8, which was released on July 1, 2021.

PHP 8.0 provides some groundbreaking optimizations and features which include:

And so much more…

In this brief tutorial, we will walk you through the installation of PHP 8.0 on Rocky Linux 8.

Step 1: Enable Remi Repository on Rocky Linux

PHP 8.0 is not yet available or present in Rocky Linux AppStream repositories. For this reason, we will install PHP 8.0 from the Remi repository which is a free third-party YUM repository that provides PHP stacks.

Right off the bat, install the EPEL repository (Extra Packages for Enterprise Linux) which provides access to commonly used software packages for Enterprise Linux.

To install the EPEL repository on Rocky Linux, run the command.

$ sudo dnf install epel-release

Once EPEL is installed, proceed and enable the Remi repository as provided.

$ sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
Enable Remi Repository on Rocky Linux

Step 2: Enable Remi Repository for PHP 8.0

PHP 7.4 is the default module on the Remi repository. This is indicated by the [d] tag. To list all the modules and confirm this, run the command:

$ sudo dnf module list php
List PHP Modules

To install PHP 8.0, we will first reset the default PHP module and enable the latest Remi PHP module which is Remi-8.0. So, run the commands below.

$ sudo dnf module list reset php
$ sudo dnf module enable php:remi-8.0
Enable PHP Remi Module

Step 3: Install PHP 8.0 in Rocky Linux

Once Remi PHP 8.0 module is enabled, you can now install PHP 8.0 and commonly used PHP extensions as follows.

$ sudo dnf install php php-cli php-curl php-mysqlnd php-gd php-opcache php-zip php-intl
Install PHP on Rocky Linux

Once installed, confirm the version of PHP installed as follows.

$ php -v

From the output, we have managed to install the latest PHP release which is PHP 8.0.8.

Check PHP Version

And that’s pretty much it. We hope that you can now confidently install PHP 8.0 on Rocky Linux 8.

Exit mobile version