How to Install PHP 8 in AlmaLinux 8

To add EPEL and REMI Repository.

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

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

To install yum utilities.

yum -y install yum-utils

To enable php 8 Remi repository.

yum module reset php

yum module install php:remi-8.0

Output:

[root@server ~]# yum module install php:remi-8.0
Last metadata expiration check: 0:00:18 ago on Tue 16 Feb 2021 11:55:11 AM EST.
Dependencies resolved.
================================================================================
 Package          Arch   Version                             Repository    Size
================================================================================
Installing group/module packages:
 php-cli          x86_64 8.0.2-1.el8.remi                    remi-modular 4.7 M
 php-common       x86_64 8.0.2-1.el8.remi                    remi-modular 1.2 M
 php-fpm          x86_64 8.0.2-1.el8.remi                    remi-modular 1.6 M
 php-mbstring     x86_64 8.0.2-1.el8.remi                    remi-modular 523 k
 php-xml          x86_64 8.0.2-1.el8.remi                    remi-modular 236 k
Installing dependencies:
 httpd-filesystem noarch 2.4.37-30.module_el8.3.0+2016+8bf57d29.alma

To install any remaining updates.

yum update

Install PHP 8

To install PHP.

yum install php

Output:

[root@server ~]# yum install php
Last metadata expiration check: 0:00:58 ago on Tue 16 Feb 2021 11:55:11 AM EST.
Dependencies resolved.
================================================================================
 Package               Arch   Version                        Repository    Size
================================================================================
Installing:
 php                   x86_64 8.0.2-1.el8.remi               remi-modular 1.6 M
Installing dependencies:
 almalinux-logos-httpd noarch 81.1-1.el8                     appstream     24 k
 apr                   x86_64 1.6.3-11.el8                   appstream    124 k
 apr-util              x86_64 1.6.1-6.el8                    appstream    105 k
 httpd                 x86_64 2.4.37-30.module_el8.3.0+2016+8bf57d29.alma
                                                             appstream    1.4 M

NOTE: It will prompt for permission type y and press Enter to proceed with the installation.

To check PHP Version.

php -v

Output:

[root@server ~]# php -v
PHP 8.0.2 (cli) (built: Feb  2 2021 19:28:42) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.2, Copyright (c), by Zend Technologies

This concludes our topic of installing PHP 8 on AlmaLinux 8 the system.