Introduction

PHP is the engine that runs over 78% of the web. But like any engine, it needs regular tune-ups. Updating your PHP version isn't just about getting new features; it's about security patchesperformance boosts (PHP 8.x is twice as fast as PHP 7.x), and plugin compatibility.

However, the update process looks completely different depending on your hosting environment. Updating a shared cPanel server is a few clicks; updating a hardened Linux Nginx server is a terminal dance.

In this guide, we will walk through the four most common server types. I’ve included visual placeholders so you know exactly what to look for at every single step.


⚠️ Crucial Pre-Update Checklist (Read This First!)

Before we touch a single setting, complete this safety checklist to avoid breaking your site:

  1. Backup Everything: Take a full file and database backup.

  2. Check Compatibility: Log into your CMS (like WordPress) and ensure your themes/plugins support the new PHP version.

  3. Enable Maintenance Mode: Put your site into "Coming Soon" mode to prevent users from seeing errors during the switch.


Method 1: Updating via cPanel / WHM (Shared Hosting)

Best for: Shared hosting, Reseller hosting, and most managed WordPress hosts.

This is the most beginner-friendly method. Hosting providers like HostGator, Bluehost, and SiteGround use variations of this.

Step 1: Log into your cPanel Dashboard
Navigate to yourdomain.com/cpanel and enter your credentials.

 

cPanel Main Dashboard Overview

You should see the main cPanel interface with various tool icons.

 

Step 2: Locate the "Select PHP Version" Tool
Scroll down to the "Software" section. Look for the icon labeled "Select PHP Version" or sometimes "MultiPHP Manager". You can also use the searchbox find it.

Step 3: Select Your Domain
If you have multiple add-on domains, use the dropdown menu at the top to select the specific domain you want to update.

Step 4: Choose the New PHP Version
You will see a dropdown menu labeled "PHP Version" or "Current Version". Click it and select the latest stable version (e.g., PHP 8.2 or 8.3).

 

The dropdown menu opened, showing options from PHP 7.4 up to 8.3, with 8.2 highlighted Marked sections indications

 

Step 5: Check Extension Settings (optional)
After switching, the page will reload. Scroll down to the "Extensions" list. Ensure common extensions like mysqlicurljson, and gd are check-marked. If they aren't, check them now.

Step 6: Finalize
Click the "Save" or "Apply" button at the bottom. Wait 1-2 minutes for the server to reload the PHP-FPM service. Clear your cache and test your site!


Method 2: Updating via Plesk Control Panel

Best for: Windows hosting or high-end Linux resellers.

Plesk has a slightly different UI but is just as easy.

Step 1: Access "PHP Settings"
From your Plesk dashboard, go to "Websites & Domains" and click on "PHP Settings" next to your domain name.

 

Plesk main interface with the Plesk main interface with the "PHP Settings" button inside a red box

 

Step 2: Select the New Version
At the top of the page, you will see a dropdown menu labeled "PHP version".

 

The PHP dropdown menu in Plesk, showing available versions The PHP dropdown menu in Plesk, showing available versions

 

Step 3: Adjust Handlers (If prompted)
Plesk often asks if you want to run PHP as an Apache moduleFastCGI, or PHP-FPM.

  • Recommendation: Choose PHP-FPM for the best performance for busy sites.

  • Click "Apply" or "OK"


 

Method 3: Updating on a Linux VPS / Dedicated Server (CLI - Nginx & Apache)

Best for: Developers, SysAdmins, and agencies managing unmanaged cloud servers (DigitalOcean, AWS, Vultr).

This is where the magic (and complexity) happens. We will use the command line. (We are using Ubuntu 22.04 with Nginx in this example).

Step 1: Connect via SSH
Open your terminal and SSH into your server:

bash
ssh root@your-server-ip

Step 2: Add the Ondřej Surý PHP Repository
The default Ubuntu repos are often outdated. You need the community-maintained PPA.

bash
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

You'll see a lot of text flying by. Look for "Done" at the end.

Step 3: Install the New PHP Version
Let’s assume you are moving from PHP 7.4 to PHP 8.2. You need to install the core PHP package plus the common extensions.

bash
sudo apt install php8.2 php8.2-cli php8.2-fpm php8.2-common php8.2-mysql php8.2-zip php8.2-gd php8.2-mbstring php8.2-curl php8.2-xml php8.2-bcmath
Type 'Y' and press Enter to begin the installation Type 'Y' and press Enter to begin the installation.

 

Step 4: Disable the Old Version and Enable the New One
This is the critical switch. We must tell the web server to use PHP 8.2.
If using Nginx + PHP-FPM:

bash
sudo systemctl disable php7.4-fpm
sudo systemctl stop php7.4-fpm
sudo systemctl enable php8.2-fpm
sudo systemctl start php8.2-fpm

If using Apache:

bash
sudo a2dismod php7.4
sudo a2enmod php8.2
sudo systemctl restart apache2

Always check the service status after running these commands

Always check the service status after running these commands.

 

Step 5: Verify it Worked
Create a temporary PHP info file to check.

bash
echo "" | sudo tee /var/www/html/info.php

Now visit yourdomain.com/info.php. You should see a giant purple/white page stating PHP Version 8.2.x.

This purple page is the ultimate confirmation of success.
(Security Tip: Delete this file immediately after testing with rm /var/www/html/info.php).


Method 4: Updating via WP-CLI (WordPress Specific)

Best for: Developers managing multiple WordPress sites on a VPS.

If you have WP-CLI installed, you can update the PHP version of a specific site without touching the global server config.

Step 1: Navigate to your site's root directory:

bash
cd /var/www/html/your-site

Step 2: Check the current PHP version your site is using:

bash
wp eval 'echo phpversion();'

Step 3: To change the version, you need to change the PHP-FPM pool. This is done by editing your Nginx/Apache config file to point to the new socket. (If you use a tool like WP-Engine or Kinsta, you can use their CLI commands. For standard servers, update the fastcgi_pass in your Nginx config from unix:/run/php/php7.4-fpm.sock to unix:/run/php/php8.2-fpm.sock).


Troubleshooting Common Update Errors

Even with perfect screenshots, things can go wrong. Here is your emergency cheat sheet:

 
 
Error Message Likely Cause The Fix
"White Screen of Death" A plugin/theme is using deprecated PHP code. Roll back the PHP version immediately, then update your plugins.
"502 Bad Gateway" PHP-FPM isn't running for the new version. SSH in and run sudo systemctl restart php8.2-fpm.
"Missing extension (e.g., MySQL)" You forgot to install the specific extension. Run sudo apt install php8.2-mysql and restart the service.

Final Verdict: Which Method Should You Use?

  • Use cPanel/Plesk if you value your sanity and want a GUI. (90% of users).

  • Use the Command Line (CLI) if you are a developer who needs absolute control over extensions and server resources.

  • Hire a SysAdmin if the terminal scares you. Seriously, it is cheaper to pay a pro for 1 hour than to lose 6 hours of revenue from a broken site.


Have a server setup I didn't cover? Drop a comment below or reach out, and I'll add it to the guide. Happy (and safe) updating!


Did this guide help you? Share it with your developer friends or save it for your next server migration. And remember, you can always contact your hosting to help you setup.