Upgrade PHP on Your Store: Compatibility Checks, Extensions, and Speed Gains

Upgrading PHP is one of the highest-ROI performance moves you can make on your own store. Going from PHP 7.4 to 8.2 runs the same code about twice as fast, with no changes to your business logic. But before you upgrade, you must do three...

PHP升级:先查兼容,再升版本PHP upgrade: check compatibility first, then bump version PHP 8.2比7.4快约2倍,但插件不兼容直接白屏PHP 8.2 ~2x faster than 7.4, but incompatible plugins = white screen ① 备份① Backup 全站+数据库Full site+DB ② 兼容检查② Compat check 插件+主题Plugins+theme ③ staging测③ Staging test 全功能走一遍Test all flows ④ 生产升④ Prod upgrade 低峰期+回滚方案Off-peak+rollback 推荐版本:PHP 8.1或8.2(安全支持到2025至2026年)Recommended: PHP 8.1 or 8.2 (security support to 2025-2026) 不要用7.4以下——已停止安全更新,2022年起无补丁Avoid <7.4 — security updates ended, no patches since 2022 必装扩展:OPcache(性能翻倍)+ mysqli + intl + gdMust-install: OPcache (2x perf) + mysqli + intl + gd OPcache开启后PHP执行时间降50%以上,内存建议256MB以上OPcache cuts PHP time 50%+; set memory to 256MB+ 反直觉:PHP版本越新越快,但不是每个插件都跟得上Counter-intuitive: newer is faster, but not all plugins keep up 一个不兼容的老插件就能让整个站白屏,升级前必须逐个测One incompatible legacy plugin = white screen; test every plugin 升级顺序:先升级所有插件到最新版,再升PHP版本Order: update all plugins first, then bump PHP version 不要跳级升级:7.4→8.0→8.1→8.2逐版升,每版测一遍Stepwise: 7.4→8.0→8.1→8.2, test each step
The four-step PHP upgrade: back up, check compatibility, test on staging, then go live

Upgrade PHP on Your Store: Compatibility Checks, Extensions, and Speed Gains

Bottom line first: Upgrading PHP is one of the highest-ROI performance moves you can make on your own store. Going from PHP 7.4 to 8.2 runs the same code about twice as fast, with no changes to your business logic. But before you upgrade, you must do three things: back up the whole site and database, check every plugin and theme for compatibility one by one, and run through every feature on a staging environment. Use PHP 8.1 or 8.2, not anything below 7.4 (those versions no longer get security updates). The must-have extension is OPcache; turning it on cuts PHP execution time by more than 50%. Counterintuitive but true: a single incompatible old plugin can white-screen your entire site, so test each one before upgrading. Don’t rely on the compatibility notice in the WordPress dashboard.

1. Why your PHP version affects store performance

WordPress is written in PHP, so every page request first runs the PHP interpreter, which translates the code into instructions the machine can execute. The newer the PHP version, the faster that translation goes. PHP 8.x includes a long list of low-level optimizations over 7.4, including OPcache improvements, JIT compilation, and better memory management, so the same code runs about twice as fast on 8.2 as on 7.4.

You feel this speed gain directly on your store. A site with an LCP of 3.5 seconds on PHP 7.4 can drop to around 2 seconds after moving to 8.2 with OPcache enabled, turning its Core Web Vitals from red to green. No theme changes, no plugin swaps, no added caching. Just changing the PHP version gets you there. That’s why ops teams recommend upgrading PHP at least once every two years.

PHP version Release date Security support ends Speed vs. 7.4 Recommendation for your store
PHP 5.6 and below Before 2014 Ended long ago Below baseline Do not use
PHP 7.0 to 7.3 2015 to 2018 Ended About 0.8x Upgrade as soon as possible
PHP 7.4 2019 Ended in 2022 Baseline 1.0 Transitional version, upgrade soon
PHP 8.0 2020 Ended in 2023 About 1.5x Works, but not for the long term
PHP 8.1 2021 End of 2025 About 1.8x Recommended, stable
PHP 8.2 2022 End of 2026 About 2.0x Recommended, latest stable release

Many stores still run on PHP 7.4 or even 7.3 because “it’s always worked fine, so I’m afraid to touch it.” But 7.4 has had no security patches since November 2022, which means new vulnerabilities go unfixed. For stores selling overseas, running on a PHP version with no security updates means the risk of getting hacked grows over time. For what to do after a hack, see What to do after your site is hacked. For security hardening and backups, see Backup and recovery drills for your site.

2. Compatibility checks: three things to do before you upgrade

The biggest risk of a PHP upgrade isn’t performance, it’s compatibility. PHP 8.x made some breaking changes to the syntax, like deprecating old functions, tightening type strictness, and changing some long-standing behaviors. If your theme or plugins use any of those deprecated patterns, your site will go straight to a white screen after the upgrade, and you won’t even be able to get into the admin.

Do three things before you upgrade. First, update all plugins and themes to the latest versions. Old versions are often incompatible with new PHP, and newer versions have usually already fixed it. Second, use a plugin like PHP Compatibility Checker to scan your entire site’s code and see which files use incompatible patterns. Third, switch the PHP version in a staging environment and walk through every core function.

Checklist How to check Pass criteria If it fails
Plugin compatibility Scan with PHP Compatibility Checker No fatal errors in any plugin Find a replacement plugin or contact the author
Theme compatibility Same as above, scan the theme directory No deprecated function calls in the theme Switch themes or wait for the author to update
WordPress core version Check the WP version in the admin PHP 8.2 requires WP 6.0 or later Upgrade WP core first
Database extensions Check phpinfo for mysqli mysqli is enabled Install the mysqli extension
Custom code Scan child themes and custom plugins No deprecated functions Edit the code manually

Example scenario: a B2B site uses an old form plugin from 2019 that throws errors on PHP 8.1. Before upgrading, you run Compatibility Checker and find the plugin uses mysql_* functions (deprecated back in PHP 7.0). Don’t force the PHP upgrade here. First find a replacement form plugin, such as WPForms or Fluent Forms, migrate the forms over, then upgrade PHP. See how crater handles plugin compatibility on overseas sites in crater’s tech stack and four in-house plugins.

Counterintuitive take: the PHP compatibility warnings in WordPress’s Site Health are often wrong. It only checks the plugin versions you currently have installed, so if you’re running the latest version of a plugin but the author hasn’t updated their compatibility testing, the admin will still say it’s compatible. The right approach is to run a scanning tool yourself, then actually test it in a staging environment. Don’t just trust what the admin tells you.

3. Choosing a PHP version: 8.1 or 8.2

Which version to upgrade to depends on two things: how long security support lasts, and how compatible your plugin ecosystem is. PHP 8.1 gets security support through the end of 2025, and PHP 8.2 through the end of 2026. For most standalone sites, 8.2 is the safer choice. It has the best performance and the longest security support. But if one of your key plugins explicitly says it only supports up to 8.1, upgrade to 8.1 first and move to 8.2 once the plugin updates.

Don’t skip versions. Going straight from 7.4 to 8.2 means jumping two major releases, and the deprecated functions and syntax changes pile up — the odds of something breaking are much higher than upgrading one version at a time. The right path is 7.4 → 8.0 → 8.1 → 8.2. Test each step on staging, and only move on once it’s clean.

Scenario Recommended version Reason What to watch for
Brand-new site PHP 8.2 Latest stable release, best performance Confirm all plugins support 8.2
Older site on 7.4 Go to 8.1 first, then 8.2 Upgrade one version at a time to cut risk Test each version on staging
Older plugin ecosystem PHP 8.0 or 8.1 Better compatibility Wait for plugin updates before upgrading
E-commerce site PHP 8.1 Most mature ecosystem Some payment plugins aren’t compatible with 8.2
Pure blog site PHP 8.2 Few plugins, good compatibility Upgrade straight to 8.2

Example: a content site runs just 5 plugins (Yoast, WP Rocket, WPForms, UpdraftPlus, Wordfence), and all of these mainstream plugins support PHP 8.2. In that case, upgrade to 8.2 on staging, test it, and push to production if it’s clean. But if the site runs WooCommerce plus a dozen ecommerce plugins, stay on 8.1 for now — when 8.2 first launched, plenty of payment and shipping plugins hadn’t caught up yet.

4. Installing extensions: OPcache and other essentials

If you upgrade PHP but skip OPcache, you only get half the performance gain. OPcache stores compiled PHP bytecode in memory, so the next time the same code runs it’s read straight from memory instead of being recompiled. With OPcache on, PHP execution time can drop by more than 50% — a bigger gain than going from 7.4 to 8.0.

Beyond OPcache, a standalone site needs a few basic extensions: mysqli (database connection, required by WordPress), gd or imagick (image processing, needed by the media library), intl (multilingual and localization), and mbstring (multibyte string handling, needed for Chinese sites). Most hosts enable these by default, but on shared hosting you may need to turn them on manually.

Extension Role Required? Recommended setting
OPcache PHP bytecode cache Required, doubles performance memory=256MB, revalidate_freq=60
mysqli MySQL database connection Required, WordPress core depends on it Defaults are fine
gd/imagick Image processing Required for the media library imagick is faster than gd
intl Localization and multilingual support Required for multilingual sites Defaults are fine
mbstring Multibyte strings Required for Chinese sites Defaults are fine
curl External HTTP requests Required, REST API depends on it Defaults are fine
xml XML parsing Required for RSS and sitemap Defaults are fine

Key OPcache settings: set opcache.memory_consumption to 256 (MB) and opcache.revalidate_freq to 60 (seconds), meaning code changes are rechecked after 60 seconds. On a development environment, set revalidate_freq to 0 so every request recompiles; on production, set it to 60 seconds to balance performance and freshness. Set the PHP memory limit (memory_limit) to at least 256M, and 512M for sites with lots of plugins.

OPcache and page caching are two separate layers, so don’t mix them up. Page caching stores HTML as files, while OPcache keeps PHP bytecode in memory. You need both working together to get LCP as low as possible. For layered cache configuration, see Three-Layer Caching Strategy for Your Own Site. For performance benchmark targets, see Core Web Vitals Optimization.

5. Upgrade Steps and Rollback Plan

When upgrading PHP in production, always pick an off-peak window (2 to 4 AM Beijing time) and have a rollback plan ready in advance. If something goes wrong during the upgrade, you need to be back on the old version within 5 minutes. Never upgrade during the day, or problems will hit visitor access and inquiries.

Steps Actions Time Rollback method
1. Back up the whole site Full backup of files and database 10 to 30 minutes Keep backup files for at least 7 days
2. Pick an off-peak window 2 to 4 AM Beijing time — Check access logs to confirm
3. Switch PHP version Switch via hosting panel or SSH 1 to 5 minutes One click to switch back to the old version
4. Test core paths Homepage, product pages, form submission 10 minutes If you get a white screen, switch back to the old version
5. Watch for 30 minutes Check error logs and traffic 30 minutes Roll back immediately if there are errors
6. Clear OPcache Restart PHP-FPM or the web server 1 minute —

Example scenario: you switch PHP from 7.4 to 8.1 in the BT Panel or cPanel, refresh the homepage, and get a white screen. Don’t panic. The first thing to do is switch back to 7.4. On most hosting panels, switching PHP versions is just one click, so you’re back in 10 seconds. Then check the error log to find which plugin is throwing the error, fix it, and try again. Don’t keep retrying while the white screen is up, or visitors will keep seeing an error page.

After upgrading, watch it for a week. Check two things: whether PHP Fatal Error shows up in the error log, and whether your Lighthouse score improves. If the error log is clean and LCP drops from 3.5 seconds to under 2 seconds, the upgrade worked. If new PHP warnings appear, first check whether they’re deprecated notices from a plugin. These warnings don’t affect functionality, but log them and deal with them at the next plugin update. In routine maintenance, checking the PHP version is a fixed item, see Six Monthly Tasks for Site Maintenance. For monitoring and alerts, see Site monitoring and alerts.

FAQ

Which PHP Version Should a WordPress Site Use?
PHP 8.1 or 8.2 is recommended. PHP 7.4 has had no security patches since November 2022, so running on it leaves you exposed. 8.1 gets security support through the end of 2025, and 8.2 through the end of 2026, with roughly 2x the performance of 7.4. If your plugin ecosystem is old and compatibility is uncertain, stay on 8.1 for now. If your plugins are all mainstream and support 8.2, go straight to 8.2. Don’t use anything below 7.0.
What should I do if my site shows a white screen after upgrading PHP?
Don’t panic. Switch back to the old PHP version right away — on most hosting panels that’s a single click, and you’re back in 10 seconds. Then check the error log to find the exact file and line throwing the error. The usual culprit is an old plugin using a function deprecated in PHP 8.x. Fix it by finding a replacement plugin or asking the author to update, and only re-attempt the upgrade once compatibility is sorted. Don’t keep retrying while the site is showing a blank screen.
What is OPcache, and do I have to enable it?
OPcache stores PHP’s compiled bytecode in memory, so the next time the same code runs it’s read straight from memory instead of being recompiled. With it on, PHP execution time drops by more than 50% — a bigger performance win than going from 7.4 to 8.0. It’s a must for production. Recommended settings: memory=256MB, revalidate_freq=60 seconds. In development, set revalidate_freq=0 so code changes take effect immediately.
Can I skip PHP versions when upgrading?
Don’t skip versions. Going straight from 7.4 to 8.2 crosses two major versions, and the deprecated functions and syntax changes pile up, making problems far more likely than upgrading one version at a time. The right path is 7.4→8.0→8.1→8.2. Test each version in staging, and only move to the next once your core features work. Test in staging before touching production — never skip versions directly on production.
Do I have to back up before upgrading PHP?
Yes. Back up all site files and the database, and keep them for at least 7 days. Switching PHP versions on a hosting panel is reversible (just switch back), but if a plugin modifies the database structure or writes files under the new PHP version, switching back can leave residue behind. A full backup is your last line of defense. For backup and restore drills, see our article on website backup and restore drills.
Is it normal for LCP not to change after upgrading PHP?
Yes. If your site already has page caching set up, LCP is mainly determined by whether the HTML cache is hit, and the PHP version has no effect on cache-hit requests. The gains from a PHP upgrade show up mainly on cache misses — for example, right after publishing a post or when someone visits an uncached page. To verify the effect of the PHP upgrade, turn off page caching in staging and run a test; you’ll see PHP execution time drop from several hundred milliseconds to under 100 milliseconds.

Final thoughts

The biggest obstacle to upgrading PHP isn’t technical — it’s the psychological “I don’t dare touch it.” Plenty of teams have had sites running on 7.4 for three years, and it’s been “running fine” the whole time, until a plugin update causes a blank screen or the site gets hacked and they finally think about upgrading PHP. In reality, a PHP upgrade is the lowest-effort, highest-return optimization there is — you don’t need to change any business code, just click to switch versions in your hosting panel and spend an hour testing your core features.

Three steps to roll it out. Step one: back up your entire site and database, then run Compatibility Checker to scan your plugins and theme for compatibility issues. Step two: upgrade version by version in staging (7.4 to 8.0 to 8.1 to 8.2), testing your core user paths after each one. Step three: push to production during off-peak hours, watch it for 30 minutes, and roll back immediately if anything breaks. Do all three and your site runs twice as fast, with security patches applied too.

One line worth remembering: upgrading PHP is the best value performance move for a standalone store. Going from 7.4 to 8.2 makes it twice as fast, but only if you test compatibility first. One outdated plugin is all it takes to white-screen your site.

Crater
Crater Crater experts

Official Organization · Crater

Crater is a go-global services company specializing in WordPress standalone site development + Google SEO + GEO full-funnel growth, serving sectors including smart hardware, industrial equipment, SaaS, and new energy.

Product CapabilitiesMethodology WhitepaperIndustry Report
965articles shared
78knowledge base articles