How to Install PHP 8.3 in AlmaLinux 9?

Share your love by sharing

Most web applications use PHP as a script language and interpreter. By default, when you install you will get the PHP 8.0 version but we all know that with each version, PHP gets faster so we must install PHP 8.3 to get the maximum performance. In this guide, we will see how to install PHP 8.3 in AlmaLinux 9

How-to-install-php-8.3-in-Almalinux-9
How-to-install-php-8.3-in-Almalinux-9

Step 1 – Add EPEL and REMI Repository

Before installing PHP, the first step is to add EPEL and REMI repositories that contain PHP 8.3 packages. So to add EPEL and REMI repository execute the following commands one by one

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

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

Step 2 – Reset the PHP default module and install the PHP 8.3 module

Next, we will reset the default PHP module and install the PHP 8.3 module so that whatever PHP module we install later on it will install the modules from the PHP 8.3 version repository only. To do so, run the following commands one by one

    # sudo dnf module reset php

    # sudo dnf module install php:remi-8.3

Output you will get as

    [root@linux ~]# dnf module install php:remi-8.3
Last metadata expiration check: 0:00:25 ago on Thu 07 Dec 2023 01:14:08 AM UTC.
Dependencies resolved.
================================================================================
 Package            Arch     Version                       Repository      Size
================================================================================
Installing group/module packages:
 php-cli            x86_64   8.3.0-1.el9.remi              remi-modular   5.5 M
 php-common         x86_64   8.3.0-1.el9.remi              remi-modular   1.2 M
 php-fpm            x86_64   8.3.0-1.el9.remi              remi-modular   1.9 M
 php-mbstring       x86_64   8.3.0-1.el9.remi              remi-modular   575 k
 php-xml            x86_64   8.3.0-1.el9.remi              remi-modular   216 k
Installing dependencies:
 httpd-filesystem   noarch   2.4.57-5.el9                  appstream       12 k
 libxslt            x86_64   1.1.34-9.el9                  appstream      240 k
 oniguruma5php      x86_64   6.9.9-1.el9.remi              remi-safe      219 k
Installing weak dependencies:
 nginx-filesystem   noarch   1:1.20.1-14.el9_2.1.alma.1    appstream      8.4 k
Installing module profiles:
 php/common
Enabling module streams:
 php                         remi-8.3

Transaction Summary
================================================================================
Install  9 Packages

Total download size: 9.9 M
Installed size: 55 M
Is this ok [y/N]:

Step 3 – Updating the repository

The next step is to update the repository because, in the above steps, we have added a new repository

    # sudo dnf update -y

Step 4 – Installing required PHP packages

Now we can install the required PHP module by executing the command below and it will install modules from the PHP 8.3 repository.

    # sudo dnf install php -y

Output you will see as

[root@linux ~]# dnf install php
Last metadata expiration check: 0:01:12 ago on Thu 07 Dec 2023 01:14:08 AM UTC.
Dependencies resolved.
================================================================================
 Package              Arch       Version                 Repository        Size
================================================================================
Installing:
 php                  x86_64     8.3.0-1.el9.remi        remi-modular     1.8 M
Installing dependencies:
 apr                  x86_64     1.7.0-11.el9            appstream        123 k
 apr-util             x86_64     1.6.1-23.el9            appstream         94 k
 apr-util-bdb         x86_64     1.6.1-23.el9            appstream         12 k
 capstone             x86_64     4.0.2-10.el9            appstream        766 k
 httpd-core           x86_64     2.4.57-5.el9            appstream        1.4 M
 httpd-tools          x86_64     2.4.57-5.el9            appstream         80 k
 libsodium            x86_64     1.0.18-8.el9            epel             161 k
 mailcap              noarch     2.1.49-5.el9            baseos            32 k
Installing weak dependencies:
 apr-util-openssl     x86_64     1.6.1-23.el9            appstream         14 k
 php-opcache          x86_64     8.3.0-1.el9.remi        remi-modular     573 k
 php-pdo              x86_64     8.3.0-1.el9.remi        remi-modular     120 k
 php-sodium           x86_64     8.3.0-1.el9.remi        remi-modular      62 k

Transaction Summary
================================================================================
Install  13 Packages

Total download size: 5.2 M
Installed size: 25 M
Is this ok [y/N]:

To check the installed PHP version, execute the below command

    # sudo php -v

Output

[root@linux ~]# php -v
PHP 8.3.0 (cli) (built: Aug 10 2024 14:40:35) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies
with Zend OPcache v8.3.0, Copyright (c), by Zend Technologies

Thats all.

Share your love by sharing
Sourabh Verma
Sourabh Verma

I.T Engineer by profession, tech lover. Passionate for reading and writing technical stuffs. Loves to share knowledge.

Leave a Reply

Your email address will not be published. Required fields are marked *