Terug naar het artikeloverzicht

How to install PHP 8 on Alma Linux & Rocky Linux

With the death of CentOS presenting itself ever closer, webmasters have been looking for alternatives which many have found in Alma Linux and Rocky Linux.

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.

Prerequsities

Before we install PHP 8 on our server, we will need a few things.

  • A server running either Alma or Rocky Linux. (I’m using a dedicated server from Spin Servers.)
  • 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

Followed by:

$ 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.

To make these how-to guides possible, I use a dedicated server from Spin Servers. The configuration I use is a:

Dual Intel Xeon E5–2630L
12x 2.00 GHz CPU
128GB DDR3 RAM
4x 2TB HDD HW RAID-10 DISKSPACE
10TB
of Bandwidth on 10Gbps Port
Dallas Location

I get this configuration for $89/month using the code “DUALE5FOR89”. This promotion is on the Spin Servers Web Hosting Talk thread found here.

If you have questions about any of Spin Server’s services, please contact us via email at [email protected] or by using our live chat at spinservers.com.

Spin Servers is a US-based provider of dedicated servers & affordable private cloud solutions. Our motto is to let you “spin up servers” fast, seamlessly, and affordably.