Installing PHP 8.3 on CentOS 8

PHP 8.3 is the latest major release of the popular server-side scripting language, bringing numerous improvements, performance enhancements, and new features. If you’re running CentOS and want to upgrade or install PHP 8.3, this guide will walk you through the process step by step.

Step 1: Update the System

Before installing PHP 8.3, it’s essential to ensure your system is up to date. Open a terminal and run the following commands:

sudo yum update
sudo yum upgrade

This will update your system’s package list and install the latest updates.

Step 2: Install Remi Repository

Remi repository is one of the third-party repositories that have the latest update of PHP on Enterprise Linux. To enable the Remi repository on your system, you will need to enable the EPEL repository as shown.

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

Next, enable the Remi repository using the command:

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

Once done, you can see the available PHP version for installation using the command:

sudo dnf module list php

On the last line, you can see that PHP 8.3 is available through the Remi repository. Thereafter, reset the module and enable PHP 8.3 as shown.

sudo dnf module reset php

Install PHP Remi

sudo dnf module install php:remi-8.3

Step 3: Install PHP 8.3 on CentOS for Apache

To install PHP for Apache web server, execute the following command.

sudo dnf install php

After the installation has completed, you can verify PHP installation

php -v

Step 4: Install PHP 8.3 FPM for Nginx

If you are running Nginx, you need to install PHP-FPM, using the command shown.

 sudo dnf install php-fpm

Next, enable FPM service to start on boot using the following command:

 sudo systemctl enable php-fpm.service

Once enabled, you can now start the PHP-FPM service as shown:

sudo systemctl start php-fpm.service

You can verify the status of PHP-FPM by running the command:

sudo systemctl status php-fpm.service

Step 5: Install PHP 8.3 Extensions

PHP extensions are libraries that extend the functionality of PHP. There are hundreds upon hundreds of them. To install a PHP extension, use the syntax:

sudo dnf install php-extension_name

For example, to enable the MySQL extension, run:

 sudo dnf install php-mysqlnd

Conclusion:

Installing PHP 8.3 on CentOS is a straightforward process involving the addition of the Remi repository and module installation. By following these steps, you can take advantage of the latest features and improvements in PHP 8.3 for your web development projects. Always refer to the official documentation for any additional configuration or troubleshooting needs.

Related Posts
Leave a Reply

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