Red Hat

Install PHP 8.0 on Rocky Linux 8

php

PHP stands for Hypertext Preprocessor which was initially released in 1995 to enhance web development. PHP 8.0 was released on November 26, 2020, with major updates like new features and optimization including null safe operator, Just in Time Compiler (JIT), error handling, match expression, etc.

In this tutorial, we will install PHP 8.0 on Rocky Linux. Let’s see how we install it then.

As PHP 8.0 version is not available in Rocky Linux AppStream repositories, we will install it from a third-party repository called Remi. First of all, we need to install the Extra Packages for Enterprise Linux (EPEL) repository that provides additional software packages for Enterprise Linux. To install EPEL execute,

$ sudo dnf install epel-release

Now, execute the following command to enable the Remi repository.

$ sudo dnf install dnf-utils
$ sudo dnf install http://rpms.remirepo.net/enterprise/remi-release-8.rpm

Once the Remi repository is added PHP 8 module can be enabled in the Remi repository. Then, we need to first reset the default PHP module, so execute,

$ sudo dnf module reset php

Reset Remi PHP Default Module.

Now, enable PHP 8 module using the following command,

$ sudo dnf module enable php:remi-8.0

Remi’s PHP 8 module enabled.

Similarly, you can view all the php modules using the following command.

$ sudo dnf module list php

Remi PHP Module List.

Now, once the module is enabled for remi php 8 you can install the PHP using the following command.

$ sudo dnf install php

Installing PHP.

Now, you can verify the installation you can check the version so,

$ php -v

Checking PHP Version.

Conclusion

In this article, we install the third-party repository (Remi) and install the PHP using it. You can install older versions of PHP from Rocky Linux AppStream. Now you are able to install PHP 8.0 in Rocky Linux.

Similar Posts