Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

[AlmaLinux 8] How to install PHP on AlmaLinux 8 / AlmaLinux 9

MichailMichail Moderator
edited June 6 in Linux Applications


The PHP programming language is one of the most widely used server-side programming languages. It is a language used to develop dynamic and responsive websites.

In this guide, we will show how to install PHP 8.3 on AlmaLinux 8 and 9 versions. However, you can apply this tutorial to any other PHP version.

Installation guide

Step for AlmaLinux 8 only: Import GPG key repository

This step is for AlmaLinux 8 only. Skip this step on CentOS 7.

Run the following command to install updated GPG keys on AlmaLinux 8:

rpm --import

1. Update the system

Make sure to check if there are any updates available:

dnf check-update

If yes, run the following command to update the system:

yum update -y

After that, reboot the system:


2. Add remi RPM repository

For PHP, we also need to install EPEL.

On AlmaLinux 8 follow these steps:

Run the following command

dnf -y install

Install the remi repository:

dnf -y install

The same procedure is for AlmaLinux 9, just run these commands:

dnf -y install

dnf -y install

After that, update DNF cache with the following command:

dnf makecache -y

3. Reset default PHP module

Before installing PHP, make sure to reset the default PHP module by running this command:

dnf module reset php -y

4. Install the PHP

To install PHP, run the following command (you can install any other version; just type a different number instead of 8.3):

dnf module install php:remi-8.3

After that run this command to complete the installation:

dnf -y install php

5. Check PHP

To check if PHP was installed successfully, you can run this command, which will provide information about the installed version:

php -v

PHP extensions

To list all the available PHP extensions, run the following command:

php -m

To install the PHP extension, you need to run the dnf install command in the following format (change the "extension_name" to the actual extension):

dnf install php-extension_name

To install multiple extensions, run this command in the following format:

dnf install php-{common,pear,cgi,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}

Sign In or Register to comment.


Learn how to install a web and database server, email, FTP client or other applications. Discover and share information on server security or optimization recommendations.
Feel free to join our constantly expanding community, participate in discussions, strengthen your knowledge on Linux and Windows server management!
© 2013 - 2024 Time4VPS. All rights reserved.

Get In Touch