×


Install PHP 8.0 on Rocky Linux 8 - Best Procedure ?

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.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related PHP extension queries on Linux System.

In this context, we shall look into how to install PHP 8.0 on Rocky Linux.


Step by Step Process to Install PHP 8 on Rocky Linux 

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

To install EPEL execute the command:

$ sudo dnf install epel-release

Now, execute the following commands 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

Next, 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

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

$ sudo dnf install php

Now, you can verify the installation you can check the version by running the command:

$ php -v


[Need help in Configuring PHP on any Linux System ? We can help you. ]


Conclusion

This article covers steps to install PHP 8.0 in Rocky Linux. PHP is used to develop static or dynamic websites or web applications. Many popular CMS such as WordPress, Magento, and Joomla is written in PHP. Frameworks such as Laravel, Symfony, and CodeIgniter is also using PHP.

To list the available PHP version on your Linux terminal, run the command:

$ sudo dnf module list php

To verify PHP version, simply run the command:

$ php -v 

To install PHP packages and dependencies, run the command:

$ sudo apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath


How to Install PHP 7.4 on Ubuntu ?

Installing PHP 7.4 on Ubuntu 19.04/18.04 is a bit different than 20.04. 1. To get started, update apt and add the required repositories:

$ sudo apt-get update
$ sudo apt -y install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update

2. And begin the install.

$ sudo apt install php7.4

3. After the install is complete, you can check the version that is installed and in use.

$ php -v