A quick rundown
Alma Linux is an Open Source, community-governed, and forever-free enterprise Linux distribution, focused on long-term stability, providing a robust production-grade platform. AlmaLinux OS is 1:1 binary compatible with RHEL® and pre-Stream CentOS.
Rocky Linux is a community enterprise operating system designed to be 100% bug-for-bug compatible with America’s top enterprise Linux distribution now that its downstream partner has shifted direction. It is under intensive development by the community. Rocky Linux is led by Gregory Kurtzer, founder of the CentOS project.
Before we install PHP 8 on our server, we will need a few things.
- A server running either Alma or Rocky Linux.
- A cup of hot tea or coffee.
Step 1 — Enable REMI Repository
Before we install PHP 8 on our system we need to install EPEL (extra packages for enterprise Linux). This provides us access to enterprise software packages.
$ sudo dnf install epel-release
Then enable the REMI repository
$ sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
Step 2 — Enable REMI PHP 8 Repository
Using this command:
$ sudo dnf module list php
Will list the current PHP modules in the REMI repository.
The default PHP version is set to v7.2. We will need to change the default version to PHP 8 and enable the late REMI repository.
$ sudo dnf module list reset php
$ sudo dnf module enable php:remi-8.0
You should see the Complete! output afterwords.
Step 3 — Install PHP 8
Now the fun part we can install PHP 8 and its commonly used modules.
$ sudo dnf install php php-cli php-curl php-mysqlnd php-gd php-opcache php-zip php-intl
Once the command finishes you can verify the PHP version by using:
$ php -v
You now have PHP 8 installed on your server! Time for more tea… or coffee.