Installing PHP 8.4 on AlmaLinux 9 via Remi Repository

PHP 8.4 is the next major version of PHP, currently in development or pre-release (alpha/beta) stage. It introduces new features and improvements. This guide explains how to install PHP 8.4 on AlmaLinux 9 using Remi’s repository — useful for developers, testers, or early adopters.

⚠️ Warning: PHP 8.4 is not stable as of May 2025. Use it only for development or testing purposes, not in production environments.

Prerequisites

Before installing PHP 8.4, update your system and install required tools.

Update System Packages

sudo dnf update -y

Install dnf-utils (for managing module streams)

sudo dnf install dnf-utils -y

This tool helps in enabling/disabling specific module streams like different PHP versions.

Enable Required Repositories

AlmaLinux 9 doesn't include all repositories by default, so you need to add EPEL and Remi repositories.

Install EPEL Repository

sudo dnf install epel-release -y

Output:

[root@vps ~]# sudo dnf install epel-release -y
Last metadata expiration check: 0:09:43 ago on Sat May 24 14:05:03 2025.
Dependencies resolved.
================================================================================
 Package               Architecture    Version            Repository       Size
================================================================================
Installing:
 epel-release          noarch          9-9.el9            extras           18 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 18 k
Installed size: 26 k
Downloading Packages:
epel-release-9-9.el9.noarch.rpm                 1.4 MB/s |  18 kB     00:00
--------------------------------------------------------------------------------
Total                                            51 kB/s |  18 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : epel-release-9-9.el9.noarch                            1/1
  Running scriptlet: epel-release-9-9.el9.noarch                            1/1
Many EPEL packages require the CodeReady Builder (CRB) repository.
It is recommended that you run /usr/bin/crb enable to enable the CRB repository.

  Verifying        : epel-release-9-9.el9.noarch                            1/1

Installed:
  epel-release-9-9.el9.noarch

Complete!

Install Remi Repository

sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y

Output:

[root@vps ~]# sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
Extra Packages for Enterprise Linux 9 - x86_64   20 MB/s |  20 MB     00:00
Extra Packages for Enterprise Linux 9 openh264  582  B/s | 2.5 kB     00:04
Last metadata expiration check: 0:00:01 ago on Sat May 24 14:16:04 2025.
remi-release-9.rpm                              285 kB/s |  32 kB     00:00
Dependencies resolved.
================================================================================
 Package            Architecture Version               Repository          Size
================================================================================
Installing:
 remi-release       noarch       9.5-2.el9.remi        @commandline        32 k

Transaction Summary
================================================================================
Install  1 Package

Total size: 32 k
Installed size: 34 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : remi-release-9.5-2.el9.remi.noarch                     1/1
  Verifying        : remi-release-9.5-2.el9.remi.noarch                     1/1

Installed:
  remi-release-9.5-2.el9.remi.noarch

Complete!

This installs .repo files and GPG keys required to fetch packages from Remi's repository.


Check Available PHP Module Streams

To confirm that PHP 8.4 is available:

dnf module list php

Look for an entry like:

php                          remi-8.4            [d]        Remi's PHP 8.4 module

If it's listed, proceed to the next step.


Enable PHP 8.4 Module

Before enabling PHP 8.4, reset any existing PHP module to avoid conflicts.

sudo dnf module reset php -y

Output:

[root@vps ~]# sudo dnf module reset php -y
Last metadata expiration check: 0:00:29 ago on Sat May 24 14:20:08 2025.
Dependencies resolved.
Nothing to do.
Complete!

Now enable the remi-8.4 module:

sudo dnf module enable php:remi-8.4 -y

Output:

[root@vps ~]# sudo dnf module reset php -y
Last metadata expiration check: 0:00:29 ago on Sat May 24 14:20:08 2025.
Dependencies resolved.
Nothing to do.
Complete!
[root@vps ~]# ^C
[root@vps ~]# sudo dnf module enable php:remi-8.4 -y
Last metadata expiration check: 0:01:59 ago on Sat May 24 14:20:08 2025.
Dependencies resolved.
================================================================================
 Package           Architecture     Version             Repository         Size
================================================================================
Enabling module streams:
 php                                remi-8.4

Transaction Summary
================================================================================

Complete!

This will configure DNF to install PHP 8.4 packages.

Install PHP 8.4 and Common Extensions

Install the base PHP package and commonly used extensions:

sudo dnf install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-bcmath php-json php-pear -y

You can modify this command to include or exclude extensions based on your project requirements.

Verify PHP Installation

Run the following command to check the installed version of PHP:

php -v

Output:

[root@vps ~]# php -v
PHP 8.4.7 (cli) (built: May  6 2025 12:31:58) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine
Zend Engine v4.4.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.7, Copyright (c), by Zend Technologies

This confirms PHP 8.4 is installed and working.

You’ve now successfully installed PHP 8.4 on AlmaLinux 9 using Remi Repository.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS