How to Install PHP 7.4 and 8.1 in AlmaLinux 10
On AlmaLinux 10, PHP 8.1 packages are not available in the default OS AppStream repositories. By default, the version of PHP available on our AlmaLinux to install is PHP 8.0, so to get the newer versions such as PHP 8.1, we need to add/enable third-party repositories such as Remi.
To install PHP 8.1, we’ll need to add/enable the Remi RPM repositories which contain the PHP 8.1 packages that we need.
Pre-requisites :
-
A system with AlmaLinux 10 installed and running.
- root access to the system.
First, let’s start by ensuring your system is up-to-date.
dnf update
Installing the EPEL and Remi Repository
For this, we use the PHP 7.4 and 8.1 packaged by Remi,
First, let us install the EPEL repository,
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
Next, install the Remi repository with the following command,
dnf install https://rpms.remirepo.net/enterprise/remi-release-10.rpm
Output:
[root@vps ~]# dnf install https://rpms.remirepo.net/enterprise/remi-release-10.rpm
Extra Packages for Enterprise Linux 10 - x86_64 22 MB/s | 4.5 MB 00:00
Last metadata expiration check: 0:00:02 ago on Thu Jun 5 06:07:28 2025.
remi-release-10.rpm 427 kB/s | 33 kB 00:00
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
remi-release noarch 10.0-3.el10.remi @commandline 33 k
Transaction Summary
================================================================================
Install 1 Package
Total size: 33 k
Installed size: 34 k
List the available PHP module stream
To check/list the available PHP versions, use the following command,
dnf module list php
Output:
[root@vps ~]# dnf module list php
Remi's Modular repository for Enterprise Linux 1.2 MB/s | 205 kB 00:00
Safe Remi's RPM repository for Enterprise Linux 1.9 MB/s | 358 kB 00:00
Remi's Modular repository for Enterprise Linux 10 - x86_64
Name Stream Profiles Summary
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 common [d], devel, minimal PHP scripting language
php remi-8.2 common [d], devel, minimal PHP scripting language
php remi-8.3 common [d], devel, minimal PHP scripting language
php remi-8.4 common [d], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Installing PHP 7.4
Now, let's install PHP 7.4 via the remi repository,
dnf module install php:remi-7.4
Output:
[root@vps ~]# dnf module install php:remi-7.4
Last metadata expiration check: 0:00:16 ago on Thu Jun 5 06:07:41 2025.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing group/module packages:
php-cli x86_64 7.4.33-23.el10.remi remi-modular 1.8 M
php-common x86_64 7.4.33-23.el10.remi remi-modular 642 k
php-fpm x86_64 7.4.33-23.el10.remi remi-modular 1.5 M
php-mbstring x86_64 7.4.33-23.el10.remi remi-modular 466 k
php-xml x86_64 7.4.33-23.el10.remi remi-modular 130 k
Installing dependencies:
httpd-filesystem noarch 2.4.63-1.el10 appstream 13 k
libxslt x86_64 1.1.39-7.el10_0 appstream 189 k
oniguruma5php x86_64 6.9.10-1.el10.remi remi-safe 217 k
php-json x86_64 7.4.33-23.el10.remi remi-modular 31 k
Installing weak dependencies:
nginx-filesystem noarch 2:1.26.3-1.el10 appstream 11 k
Installing module profiles:
php/common
Enabling module streams:
php remi-7.4
Transaction Summary
================================================================================
Install 10 Packages
You can update your system and install packages at any time by running the following command,
dnf update
Check Installed PHP Version
Now that we have installed PHP 7.4 via the remi repository, we can verify the version installed by running the php -v
command,
php -v
Output:
[root@vps ~]# php -v
PHP 7.4.33 (cli) (built: Mar 18 2025 06:46:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Installing PHP 8.1
Now, let's install PHP 8.1 via the remi repository,
dnf module install php:remi-8.1
Output:
[root@vps ~]# dnf module install php:remi-8.1
Last metadata expiration check: 0:00:11 ago on Thu Jun 5 06:29:59 2025.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing group/module packages:
php-cli x86_64 8.1.32-1.el10.remi remi-modular 2.1 M
php-common x86_64 8.1.32-1.el10.remi remi-modular 673 k
php-fpm x86_64 8.1.32-1.el10.remi remi-modular 1.7 M
php-mbstring x86_64 8.1.32-1.el10.remi remi-modular 470 k
php-xml x86_64 8.1.32-1.el10.remi remi-modular 141 k
Installing dependencies:
httpd-filesystem noarch 2.4.63-1.el10 appstream 13 k
libxslt x86_64 1.1.39-7.el10_0 appstream 189 k
oniguruma5php x86_64 6.9.10-1.el10.remi remi-safe 217 k
Installing weak dependencies:
nginx-filesystem noarch 2:1.26.3-1.el10 appstream 11 k
Installing module profiles:
php/common
Enabling module streams:
php remi-8.1
Transaction Summary
================================================================================
Install 9 Packages
You can update your system and install packages at any time by running the following command,
dnf update
Check Installed PHP Version
Now that we have installed PHP 8.1 via the remi repository, we can verify the version installed by running the php -v
command,
php -v
Output:
[root@vps ~]# php -v
PHP 8.1.32 (cli) (built: Mar 11 2025 22:09:20) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.32, Copyright (c) Zend Technologies
DONE!
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