Most of the websites and other web applications are using PHP to run, it is an open-source server-side scripting language to deliver generate dynamic web pages. Currently, while writing this tutorial, the latest version of this language was PHP 8.0 to provide better performance to our web application. Here in this tutorial, we will learn the steps to install PHP 8.0 on AlmaLinux 8 or Rocky.
PHP 8.0 Installation on AlmaLinux or Rocky Linux
Step 1. Add Remi Repository on your Linux
By default, the version of PHP available on our AlmaLinux or Rocky to install is PHP 7.2, so to get the latest version i.e 8.0 we need to add the third-party repository to get the wide range of PHP versions.
sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
Step 2: Run system update
To update the package repository so that our system could recognize the added newly repo, run the system update command:
sudo dnf update
Step 3: Check available PHP module
Let’s check what are the available version of PHP on our AlmaLinux to install. For that run module list command to it using the DNF package manager.
sudo dnf module list php
You will see the PHP 8.0 version along with PHP 7.x to install in Remi’s Module repository for Enterprise Linux 8.
Step 4: Enable php:remi-8.0 module
As there are multiple versions of PHP to install, thus we have to mention the version along with the repo name to enable the default source to get this scripting packages to install on our system. Here is the command to run but first reset the PHP module set for system repository packages.
sudo dnf module reset php
And then run:
sudo dnf module enable php:remi-8.0
Note: In case you want to enable some other module version of PHP, then just change the version number in the above-given command.
Step 5: Command to install PHP 8.0 on AlmaLinux/Rocky from Remi Repo
Finally, run the command that will install the latest PHP on our Linux system.
sudo dnf install php -y
To install any particular extension, use the following syntax:
sudo dnf install php-extension-name
To check what are the installed and active extensions for your PHP, use:
php -m
Step 5: Check Version
Once the installation is completed, let’s check what is the version finally we have on our system.
php -v
Hi, what abaut PHP 8.0 on AlmaLinux on aarch64?
Process is the same , i only had to add –nogpgcheck to install the remi release rpm.
sudo dnf –nogpgcheck install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm