WordPress7 min readPublished: 11 Feb 2025Updated: 9 Nov 2026

PHP Versions for WordPress: Which One to Run

Which PHP version WordPress should run on, how to check the one you are using, and how to upgrade without breaking the site when a plugin will not cooperate.

G7Cloud Engineering
Platform team
Share:
Abstract illustration representing php versions for wordpress: which one to run.
  • Run a PHP version that still gets security fixes. An unsupported version is an unpatched one.
  • Check yours in the WordPress admin under Tools, Site Health, Info, Server. No plugin needed.
  • Newer PHP runs the same code faster, so you gain speed for the cost of the upgrade alone.
  • Test on a staging copy first. Almost every upgrade problem is one abandoned plugin, and staging is where you want to find it.
  • If a plugin blocks the upgrade, replace the plugin. Staying on unsupported PHP to keep it is the worse trade.

Which PHP version should WordPress run on?

Run the newest PHP version that your plugins and theme support and that still gets security updates. Each PHP release gets two years of bug and security fixes, then one year of security fixes only, then nothing. After that date, any new flaw in PHP itself stays unfixed on your server.

Version statusWhat it means for you
Actively supportedBug fixes and security fixes. The version to be on
Security support onlySecurity fixes only. Fine, but plan the next move
End of lifeNo fixes at all. Upgrade is the only response
PHP 7.xAll branches are end of life. Upgrade regardless of anything else

Check the current dates at php.net/supported-versions before deciding. They move every year.

"It still works" does not mean "it is supported"

An end-of-life PHP version keeps running perfectly, and nothing warns you it has stopped getting patches. A flaw found after the end date is never fixed.

Check what you are running
# From the command line
php -v

# The version PHP-FPM is actually serving, which can differ from the CLI
php-fpm8.3 -v
curl -sI https://example.com/ | grep -i x-powered-by

# Via WP-CLI
wp eval 'echo PHP_VERSION . PHP_EOL;'

# In the admin: Tools, Site Health, Info, Server
The command line and the web server often run different versions. The web server's version is the one your site uses.

How much faster is a newer PHP version?

Enough to justify the upgrade on its own. Every release since PHP 7.0 has run the same code faster. On WordPress that means fewer CPU seconds per request, so the same server handles more visitors at once.

Measure it on a staging copy of your own site rather than trusting a benchmark, because your plugins decide the real number.

Measure the difference yourself
# Time to first byte, cache bypassed, ten runs
for i in $(seq 1 10); do
  curl -s -o /dev/null -w '%{time_starttransfer}\n' \
    "https://staging.example.com/?nocache=$RANDOM"
done | awk '{s+=$1; n++} END {printf "avg TTFB: %.3fs over %d runs\n", s/n, n}'

# CPU time for a WordPress bootstrap
time wp eval 'echo "ok";'
The ?nocache= parameter gets past the page cache, so you time PHP rather than a stored page.

Leave the JIT off

PHP 8's JIT (a compiler for number-heavy code) does little for a web request, which spends most of its time waiting on the database and disk. It has also caused hard-to-trace memory faults on PHP 8.3, so we keep it off on our platform. Keep OPcache (PHP's compiled-code cache) on: that is the large, reliable win.

How do I upgrade PHP safely?

Always on a staging copy first. The upgrade takes minutes. Finding the broken plugin on the live site takes much longer and costs you visitors while you look.

  1. 1Update everything else first: WordPress core, every plugin and the theme, as you would when patching the server underneath. Half of PHP compatibility problems go away here, because the fix was already released.
  2. 2Look for abandoned plugins. Anything not updated for over a year is the likely blocker. Find a replacement before the upgrade, not during it.
  3. 3Clone the site to staging and switch that copy to the new PHP version.
  4. 4Run a compatibility scan with PHPCompatibility, then use the site for real: checkout, forms, admin, media upload and every integration.
  5. 5Watch the error log while you test. PHP 8 turned many old notices into fatal errors, so a warning you ignored for years may now be a white screen.
  6. 6Switch production in a quiet window, and keep the old version installed so you can switch back in seconds.
Installing a newer PHP alongside the old one
# Ubuntu, using the ondrej PPA
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php8.3-fpm php8.3-mysql php8.3-curl php8.3-gd \
  php8.3-mbstring php8.3-xml php8.3-zip php8.3-intl php8.3-bcmath php8.3-imagick

# Both versions installed side by side. Point the site at the new socket:
# fastcgi_pass unix:/run/php/php8.3-fpm.sock;
sudo nginx -t && sudo systemctl reload nginx

# Switching back is one line and a reload
# fastcgi_pass unix:/run/php/php8.1-fpm.sock;
Keeping both installed is what makes the rollback instant. Leave the old version in place until the new one has run for a week.

Install the extensions too

php8.3-fpm on its own is a PHP with almost nothing in it. WordPress needs mysql, curl, gd or imagick, mbstring, xml and zip at minimum. Without mbstring, characters break; without gd, image resizing fails. Check with php -m before you switch anything.

Compatibility scan
# PHPCompatibility via composer
composer global require phpcompatibility/php-compatibility
phpcs -p . --standard=PHPCompatibility --runtime-set testVersion 8.3 \
  --extensions=php --ignore='*/vendor/*,*/node_modules/*'

# Or from inside WordPress
wp plugin install php-compatibility-checker --activate

# Plugins not updated in over a year: the usual blockers
wp plugin list --fields=name,version,update,status
Scanners report many false alarms from vendor folders. Exclude them, or you will spend the day reading noise.

What breaks when upgrading to PHP 8?

PHP 8 is stricter than 7.x, so sloppy code it used to tolerate now stops with a fatal error. Five patterns cause most of what you will see, and all five come from plugin or theme code, not WordPress core.

ErrorCauseFix
Uncaught TypeError: passed nullPassing null where a string was expectedUpdate the plugin; it is a known PHP 8 change
Cannot use function return value in write contextOld syntax removed in PHP 8The plugin needs updating
Call to undefined functionAn extension is not installedInstall the missing php8.3-* package
Deprecated: Required parameter follows optionalArgument order PHP 8 rejectsUpdate the plugin
White screen, nothing in the browserA fatal error with display_errors offRead the PHP error log, not the page

The pattern is the same each time: the plugin needs an update. If there is none, that plugin is the problem.

Finding the real error behind a white screen
# Follow the PHP error log while you reload the page
sudo tail -f /var/log/php8.3-fpm.log
sudo tail -f /var/log/nginx/error.log

# Turn on WordPress debug logging (staging only)
# in wp-config.php:
#   define('WP_DEBUG', true);
#   define('WP_DEBUG_LOG', true);
#   define('WP_DEBUG_DISPLAY', false);
tail -f wp-content/debug.log
Never set WP_DEBUG_DISPLAY to true on a live site: PHP errors can show file paths and sometimes credentials. If you cannot find the output, see where each log lives.

One abandoned plugin should not pin your PHP version

If a plugin only runs on unsupported PHP, keeping it means running unpatched PHP on a public server. Replace the plugin, or pay someone to fix it.

Once you are on a current version, the next gain comes from how PHP is configured. Tuning PHP-FPM for performance covers worker counts and OPcache. On G7Cloud you change a site's PHP version in the dashboard (7.4 to 8.4 are offered), and switching back is the same setting; the site restarts for a few seconds each time. See our WordPress hosting.

Frequently asked questions

What PHP version should I use for WordPress?

The newest version that still gets security support and that your plugins and theme work with. Check the current dates at php.net/supported-versions. Anything on PHP 7 is end of life and should be upgraded whatever else is going on.

How do I check which PHP version my WordPress site uses?

In the admin, go to Tools, Site Health, Info, and open the Server section. On the command line, php -v shows the command-line version, which often differs from the web server's. curl -sI https://yoursite.com | grep -i x-powered-by shows the version serving your pages.

Will upgrading PHP break my WordPress site?

It can, and it is almost always one abandoned plugin, not WordPress itself. Update everything first, test on a staging copy, and keep the old PHP version installed so switching back takes one config line and a reload.

Is PHP 8 faster than PHP 7 for WordPress?

Yes, on the same unchanged code. The gain shows as less CPU per request, so the same server handles more visitors at once. Measure it on a staging copy of your own site, since your plugins decide the real figure.

Should I enable the PHP JIT for WordPress?

No. A WordPress request spends most of its time on the database and disk, so the JIT gains little, and it has caused memory faults on PHP 8.3. Keep OPcache on and the JIT off.

What PHP extensions does WordPress need?

At minimum mysqli, curl, gd or imagick, mbstring, xml and zip. Many plugins and WooCommerce also need intl and bcmath. Installing php8.3-fpm alone leaves you without them, so check what is loaded with php -m before you switch the site over.

Put this into practice on G7Cloud

Every site runs in its own dedicated container behind ScaleShield, with daily backups that are restore-tested every night. Start on the free plan, no card needed.

About G7Cloud Engineering

Platform team

Articles written by the engineers who build and run G7Cloud: UK managed hosting and the AI Website Builder. We write about what we operate every day: containers, backups, databases, and the small-business websites that run on them.

More about G7Cloud →