PHP 8.3 Installation on AlmaLinux 9 / Rocky Linux 9

This guide intends to teach you PHP 8.3 Installation Steps on AlmaLinux 9 / Rocky Linux 9 and RHEL 9. PHP 8.3 is the latest release of PHP programming language that will released on 23 NOV. So we decided to provide a PHP 8.3 installation guide on RHEL 9.

To get more information about this newly released version, you can visit Upcoming PHP 8.3 and New Improvements.

Also, if you are a Debian-based user, you can get the installation steps and upgrade process by visiting this guide on Upgrade Default PHP to PHP 8.3 in Debian / Ubuntu.

Steps To PHP 8.3 Installation on AlmaLinux 9 / Rocky Linux 9 / RHEL 9

You can use this installation guide for any RHEL 9 distros such as AlmaLinux 9 and Rocky Linux 9. Before you start, you must have access to your server as a non-root user with sudo privileges. For this purpose, you can visit the following initial setup guides:

Initial Server Setup with AlmaLinux 9

Initial Server Setup with Rocky Linux 9

Now proceed to the following steps to complete this guide.

Step 1 – Run System Update and Upgrade on AlmaLinux 9 / Rocky Linux 9

As you may know, the default PHP version in RHEL 9 is PHP 8.1. To get the latest version, you must add the Epel and Remi repositories to your server.

To start, you must run the system update and upgrade with the commands below:

# sudo dnf update -y
# sudo dnf upgrade -y

Step 2 – Add Epel and Remi Repositories on AlmaLinux 9 / Rocky Linux 9

At this point, you can use the command below to install the Epel repository on your RHEL 9 server:

sudo dnf install epel-release -y

Then, use the following command to install the Remi repository on your server which is used to install the PHP versions on RHEL-based distros:

sudo dnf install -y dnf-utils http://rpms.remirepo.net/enterprise/remi-release-9.rpm

Again run the system update to apply the changes:

sudo dnf update -y

Step 3 – Remove the Previous PHP version installed

If you have other versions of PHP and PHP-FPM installed on your server, you must remove them. This is useful for upgrading the PHP version in RHEL 9. To do this, run the command below:

sudo dnf remove php php-fpm -y

Also, you can remove other PHP extensions by using the command below:

sudo dnf remove php* -y

Step 4 – Enable PHP 8.3 Repository on AlmaLinux 9 / Rocky Linux 9

At this point, you can list the PHP Remi module with the command below:

sudo dnf module list reset php -y

In your output, you will see:

Output
Extra Packages for Enterprise Linux 9 openh264  1.1 kB/s | 2.5 kB     00:02
AlmaLinux 9 - AppStream
Name      Stream       Profiles                       Summary
php       8.1          common [d], devel, minimal     PHP scripting language

Remi's Modular repository for Enterprise Linux 9 - x86_64
Name      Stream       Profiles                       Summary
php       remi-7.4     common [d], devel, minimal     PHP scripting language
php       remi-8.0     common [d], devel, minimal     PHP scripting language
php       remi-8.1     common [d], devel, minimal     PHP scripting language
php       remi-8.2     common [d], devel, minimal     PHP scripting language
php       remi-8.3     common [d], devel, minimal     PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

As you can see, PHP REMI 8.3 is the latest version. To enable the module, run the command below:

sudo dnf module enable php:remi-8.3

Step 5 – Command To Install PHP 8.3 on AlmaLinux 9 / Rocky Linux 9

At this point, you can simply use the following command to install PHP 8.3 on your RHEL 9 server:

sudo dnf install php -y

When your installation is completed, you can verify it by checking its version:

php -v
Output
PHP 8.3.0RC5 (cli) (built: Oct 24 2023 11:44:58) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.3.0RC5, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.0RC5, Copyright (c), by Zend Technologies

As you can see, this is a RC version. You can wait until NOV 23 to get the latest release and use this instruction to install it.

Also, if you are looking for the most useful PHP extensions, you can use the command below:

sudo dnf install php-cli php-fpm php-curl php-mysqlnd php-gd php-opcache php-zip php-intl php-common php-bcmath php-imap php-imagick php-xmlrpc php-json php-readline php-memcached php-redis php-mbstring php-apcu php-xml php-dom php-redis php-memcached php-memcache

If you are looking for a development package, you can use the command below:

sudo dnf install php-devel -y

That’s it, you are done.

Conclusion

PHP installation is straightforward in Linux distros. At this point, you have learned PHP 8.3 Installation Steps on AlmaLinux 9 / Rocky Linux 9 and RHEL 9. Currently, PHP 8.3 is available in the RC version until NOV 23 the complete version will be released.

Hope you enjoy it.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!