How to Install PHP 8.3 in Rocky Linux 9

PHP is a script language and interpreter that is freely available and used primarily on Linux Web servers.

To add EPEL and REMI Repository.

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

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

To install yum utilities.

dnf -y install yum-utils

To enable php 8.3 Remi repository.

dnf module reset php

dnf module install php:remi-8.3

Output:

 [root@vps ~]# dnf module install php:remi-8.3
Last metadata expiration check: 0:00:14 ago on Thu 07 Dec 2023 04:19:38 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         13 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     appstream        8.5 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]:

To install any remaining updates.

dnf update

Install PHP 8.3

To install PHP.

dnf install php

Output:

[root@vps ~]# dnf install php
Last metadata expiration check: 0:05:55 ago on Thu 07 Dec 2023 04:19:38 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 PHP Version.

php -v

Output:

[root@vps ~]# php -v
PHP 8.3.0 (cli) (built: Nov 21 2023 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

This concludes our topic of installing PHP 8.3 on Rocky Linux 9 the system.