Home  »  GuidesHow ToLibrariesProgrammingSoftwareTechnologyTools   »   How to Install PHP 8.3 on Rocky Linux 8.10 Systems

How to Install PHP 8.3 on Rocky Linux 8.10 Systems

Rocky Linux 8.10, a community enterprise operating system designed to be 100% bug-for-bug compatible with America’s top enterprise Linux distribution, is gaining traction among developers and system administrators. One of the key tasks you may need to perform on Rocky Linux is installing PHP, a widely-used general-purpose scripting language that is especially suited for web development.

PHP 8.3, the latest PHP release at the time of writing, offers new features and improvements that enhance performance and developer experience. Here’s a step-by-step guide to installing PHP 8.3 on Rocky Linux 8.10 systems.

Step 1: Update Your System

Before installing new software, it’s always a good practice to update your system packages to the latest version. You can do this by running the following command:

$ sudo dnf update -y

Step 2: Enable Remi’s Repository

PHP 8.3 packages are available in Remi’s third-party RPM repository. To add it to your system, execute the following command:

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

Step 3: Install EPEL Repository

The EPEL repository contains additional packages for Enterprise Linux, which are sometimes dependencies for other packages. Install it using:

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

Step 4: Update DNF Cache

After adding the repositories, refresh your DNF cache:

$ sudo dnf makecache -y

Step 5: Reset PHP Module

Reset the default PHP module on your system to avoid conflicts:

$ sudo dnf module reset php -y

Step 6: Install PHP 8.3

Now, enable the PHP 8.3 Remi module and install PHP along with some commonly used extensions:

$ sudo dnf module enable php:remi-8.3 -y
$ sudo dnf install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl -y

Step 7: Verify PHP Installation

To ensure PHP has been installed correctly, check the version:

$ php -v

Step 8: Configure PHP (Optional)

PHP comes with a default configuration file located at /etc/php.ini. You can edit this file to customize your PHP settings.

Step 9: Start and Enable PHP-FPM Service

PHP-FPM is a daemon for handling PHP requests. Start and enable it using:

$ sudo systemctl start php-fpm
$ sudo systemctl enable php-fpm

Step 10: Test PHP Installation

Create a info.php file in your web server’s document root with the following content:

<?php
  phpinfo();
?>

Access this file through your web browser to view PHP configuration details.

By following these steps, you should have PHP 8.3 running on your Rocky Linux 8.10 system. This setup is ideal for developing and deploying modern web applications.

For more detailed guides and troubleshooting, refer to the official PHP documentation and the Rocky Linux forums.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.