If you’re running a website or app on a CentOS server, using the latest PHP version can help with performance and security. PHP 8.3 is the newest stable release and comes with useful updates.
In this guide, I’ll show you how I installed PHP 8.3 on CentOS. You’ll see how to do it step-by-step. I’ll also explain a few things along the way.
Let’s get started.
Why Upgrade to PHP 8.3?
Still using PHP 7 or an older version? That’s common. But newer versions like PHP 8.3 are better in a few ways.
Here’s why I think it’s worth the upgrade:
- Faster – PHP 8.3 runs code more efficiently. Sites load quicker.
- More secure – Older PHP versions don’t get updates anymore.
- New features – Developers get access to modern functions and syntax.
If you use WordPress, Laravel, or other PHP apps, many of them now recommend PHP 8 or above.
Now the question is: how do you get PHP 8.3 on CentOS?
Which Version of CentOS Are You Using?
First, check what version of CentOS your server is running. You can do that with this command:
cat /etc/centos-release
If you’re on CentOS 7, this guide will work for you.
If you’re on CentOS Stream 8 or 9, some steps might be a little different. I’ve tested these instructions on CentOS 7.
Step 1: Update Your System
Before installing anything, it’s smart to update your system.
sudo yum update -y
This keeps all your software current and avoids errors later.
Step 2: Enable the Remi Repository
CentOS doesn’t include the latest PHP versions in its default repositories. To install PHP 8.3, we’ll use a third-party repo called Remi.
Install the EPEL and Remi repositories:
sudo yum install epel-release -y
sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
Now enable the Remi repository:
sudo yum install yum-utils -y
sudo yum-config-manager --enable remi
Then enable the PHP 8.3 module specifically:
sudo yum-config-manager --enable remi-php83
Step 3: Install PHP 8.3 and Common Extensions
Now you’re ready to install PHP 8.3.
sudo yum install php php-cli php-fpm php-mysqlnd php-opcache php-gd php-curl php-mbstring php-xml php-zip -y
This command installs PHP and several useful extensions.
Here’s what they do:
php-mysqlnd
: lets PHP connect to MySQL or MariaDB.php-fpm
: runs PHP as a service.php-mbstring
: helps handle strings in different languages.php-xml
,php-zip
,php-curl
: used by WordPress and many web apps.
Want to see if it worked?
Run this command:
php -v
You should see something like:
PHP 8.3.x (cli) ...
If you do, PHP 8.3 is installed.
Step 4: Start and Enable PHP-FPM
If you’re using Nginx or even Apache with FPM, start the PHP-FPM service:
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
You can check the status:
sudo systemctl status php-fpm
Make sure it’s running. If it isn’t, it could be a permission issue. Feel free to check the logs:
sudo journalctl -xe
Step 5: Connect PHP with Web Server
Are you using Apache or Nginx?
If Apache:
Make sure php
works with mod_php
. It should already be active. Restart Apache:
sudo systemctl restart httpd
If you’re using Nginx:
You need to edit your server block file to pass .php
files to php-fpm
.
Here’s a simple block to use in /etc/nginx/conf.d/your-site.conf
:
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
Then restart Nginx:
sudo systemctl restart nginx
Now Nginx will process .php
files using PHP 8.3.
Step 6: Test PHP with a Web Page
To confirm PHP is working through your web server, create a test file:
sudo nano /var/www/html/info.php
Add this:
<?php phpinfo(); ?>
Save and go to your server’s IP in your browser:
http://your-server-ip/info.php
If you see the PHP info page, it’s working.
Don’t forget to delete that file when you’re done:
sudo rm /var/www/html/info.php
Pros of PHP 8.3 Compared to Older Versions
I noticed a few differences after switching to PHP 8.3:
- Faster page loads, especially with large WordPress sites
- New functions like
json_validate()
that make coding easier - Better error messages – they’re clearer now
If your app supports it, I suggest trying PHP 8.3.
Tips Before Upgrading Production Sites
If you’re running live websites, test them first.
Here are a few things to watch for:
- Plugin Compatibility – some old WordPress plugins don’t work with PHP 8.3
- Deprecated Functions – older code might break
- Missing Extensions – make sure you installed the needed PHP modules
You can set up a staging server or use a tool like LocalWP to test on your computer.
PHP Extensions I Use Often
These are useful for most web apps:
php-mysqlnd
php-curl
php-mbstring
php-gd
php-xml
php-zip
Other helpful ones:
php-intl
– for international language supportphp-soap
– used in some payment gateways
You can install them any time:
sudo yum install php-zip php-soap php-intl
Restart your web server afterward.
What Happens to Old PHP Versions?
If you had PHP 7.4 or 8.0 before, they’ll still be on the system unless you remove them.
You can list all installed PHP versions:
php -v
Or:
rpm -qa | grep php
I usually remove the old one once I know everything works:
sudo yum remove php*
But be careful. Make a backup first.
Final Thoughts
Installing PHP 8.3 on CentOS isn’t too hard if you follow the steps. The Remi repo makes it simple. I think it’s worth the upgrade for performance and security reasons.
If your app supports it, I’d say go for it. Just test carefully if it’s for a live site.