How to Install PHP 8.3 in RHEL 9 Linux

PHP is a popular programming language used for building dynamic web applications. With the release of PHP 8.3, developers gain access to new features and improvements.

For this guide, we will be operating the system as root, if that is not the case for you, make use of the sudo command to acquire root privileges.

Step 1: Update System Packages

To install the latest version of PHP, first, you need to update your system’s package repository and install newer available packages using the dnf command.

sudo dnf update
Update System Packages
Update System Packages

Step 2: Enable EPEL Repository in RHEL

Next, install the epel-release package, which provides additional packages for the RHEL system.

sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
Enable EPEL Repository in RHEL
Enable EPEL Repository in RHEL

Step 3: Enable Remi Repository in RHEL

Next, you need to enable the Remi repository which offers the latest PHP versions for RHEL systems.

sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
Enable Remi Repository in RHEL
Enable Remi Repository in RHEL

Step 4: Install PHP 8.3 in RHEL

 

 

Now, you can install PHP 8.3 along with the necessary extensions.

sudo dnf module install php:remi-8.3
Install PHP in RHEL
Install PHP in RHEL

Once installed, you can verify the PHP installation.

php -v
Verify PHP in RHEL
Verify PHP in RHEL

Step 5: Install Additional PHP Extensions (Optional)

Depending on your project requirements, you may need to install additional PHP extensions.

sudo dnf search php-*
Search for PHP Extensions
Search for PHP Extensions

Next, install the desired extensions using:

sudo dnf install php-gd php-xml
Install PHP Extensions in RHEL
Install PHP Extensions in RHEL

If you’re using Apache or Nginx as your web server, restart it to apply the changes.

sudo systemctl restart httpd
Or
sudo systemctl restart nginx

Lastly, below is a list of useful PHP articles that you can read for additional information:

You have successfully installed PHP 8.3 on your RHEL 9 system. You can now start developing or hosting web applications using the latest PHP version, taking advantage of its new features and enhancements.

Similar Posts