Share your love
Easy Steps To Install PHP 8.3 on Centos 7

In this guide, you will learn to Install PHP 8.3 on Centos 7. The default PHP version provided by the base Centos 7 repositories is PHP 5.4. However, it’s important to note that CentOS 7 has reached its end of life and is no longer actively maintained, which means it may not receive updates or security patches.
If you need a newer PHP version, you can install it manually from third-party repositories such as Remi’s RPM repository, which provides updated PHP versions for CentOS. To do this, you can follow the steps below on the Orcacore website to Install PHP 8.3 on Centos 7.
Table of Contents
Learn to Install the Latest PHP 8.3 on Centos 7
Before you start your PHP setup, you must access your server as a non-root user with sudo privileges. For this purpose, you can check the Centos 7 Initial Setup Guide.
Now proceed to the next steps to start your PHP 8.3 setup on Centos 7.
Also, you can get more info about PHP 8.3 by visiting PHP 8.3 and New Improvements.
Step 1 – Required Packages For PHP 8.3 Setup on Centos 7
First, you must run the system update by using the following command:
sudo yum update -y
Then, you must add the Epel repository to your server by using the command below:
sudo yum install epel-release -y
Next, you need to install the Remi repository to get the latest PHP on Centos 7:
sudo yum -y install yum-utils https://rpms.remirepo.net/enterprise/remi-release-7.rpm
Once you are done, run the system update to apply new repositories:
sudo yum update -y
Step 2 – Remove Old PHP Versions From Centos 7
Now you need to remove the PHP and PHP-FPM previous versions if you have them installed on your server. To do this, run the following command:
sudo yum remove php php-fpm php* -y
Now disable the Remi repository for old PHP with the following command:
sudo yum-config-manager --disable 'remi-php*'
Step 3 – Enable and Install PHP 8.3 on Centos 7
At this point, you need to enable the Remi for PHP 8.3 on Centos 7 with the following command:
sudo yum-config-manager --enable remi-php83
Run the command below to see if the Remi repository for PHP 8.3 is enabled on your server:
sudo yum repolist

As you can see, the repository is successfully enabled. Now you can use the command below to install PHP 8.3 on Centos 7:
sudo yum -y install php
You can verify your installation by checking its version:
php -v

You can use the command below to install the most common PHP extensions on your server:
sudo yum install php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json,opcache,redis,memcache}
Step 4 – Configure PHP-FPM Service For Nginx
By default on Centos 7, the PHP-FPM service is designed to be run by (Apache) user. If you are using Nginx you need to make configuration changes at (www.conf).
You can open the file with your favorite text editor like Vi Editor or Nano Editor:
sudo vi /etc/php-fpm.d/www.conf
Find the user and group directives and change them to Nginx as shown below:
user = nginx
group = nginx
When you are done, save and close the file.
Reload the PHP-FPM service to apply the changes:
sudo systemctl restart php-fpm
The Nginx server block needs the following example below for Nginx to process the PHP files.
Below is an example for all server {} blocks that process PHP files that need the location ~ .php$ added.
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
Conclusion
At this point, you have learned to Install PHP 8.3 on Centos 7 which helps ensure the security, performance, compatibility, and stability of your web applications and development environment. Hope you enjoy the PHP 8.3 Setup on Centos 7.
Also, you may like to read the following articles:
Disable systemd-resolved on Centos 7