How to Install PHP 8.1 on AlmaLinux 8?

Install PHP 8.1 on AlmaLinux 8 using this step by step guide.

Install EPEL Repository

Install EPEL repository using the following command.

sudo yum -y install epel-release

Install Remi Repository

Install Remi repository using the following command.

sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm

Install yum Utilities

sudo yum -y install yum-utils

Install yum utilities.

Install PHP 8.1

Enable PHP 8.1 using the following commands.

sudo yum module reset php
sudo yum module install php:remi-8.1

Dependencies will begin to install and once completed, run the following command to ensure that the operating system has the latest updates installed.

sudo yum update -y

Once the update has completed, run the following command to install PHP 8.1

sudo yum install php -y

Once PHP 8.1 installation has completed successfully, type the following command to confirm the installed version.

php -v

You should see text displayed on your terminal window confirming the that PHP 8.1 is the installed and running version.