How to Install PHP 8.3 in Rocky Linux 9?

PHP is a widely used scripting language along with an interpreter. We all know that the latest version of PHP is always faster and better than its previous version. When you install PHP on your Rocky Linux server, you will get PHP 8.0 version but, the latest stable version is PHP 8.3. That is better in terms of performance than PHP 8.0. In this guide let’s see how to install PHP 8.3 in Rocky Linux 9.

How-to-install-php-8.3-in-rocky-linux-9
How-to-install-php-8.3-in-rocky-linux-9

Step 1 – Adding EPEL and REMI repository

Before proceeding with PHP 8.3 installation we will add EPEL and REMI repositories. To add these repositories, 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 old PHP Module and Install PHP 8.3

Next, let’s reset the default PHP version and install PHP 8.3 module by executing the commands below

    # sudo dnf module reset php

    # sudo dnf module install php:remi-8.3

The output should look like this

[root@linux ~]# dnf module install php:remi-8.3
Last metadata expiration check: 0:00:14 ago on Thu 10 Aug 2024 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]:

Step 3 – Updating the repository

Since we have added a new repository in our previous steps, let’s update the repository

    # sudo dnf update -y

Step 4 – Install the required PHP modules

Now we are ready to install the required PHP modules.

    # sudo dnf install PHP

The output should look like this

[root@linux ~]# dnf install php
Last metadata expiration check: 0:05:55 ago on Thu 10 Aug 2024 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 installed PHP version execute the command below

    # 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.

Category:

Comments

Leave a Reply

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