As a webmaster with over 15 years of experience running WordPress sites, I‘ve been through my fair share of rocky PHP transitions.
Believe me, I understand how nerve-wracking it can be when your web host announces they‘ll be upgrading PHP versions on their servers.
You start worrying:
"Is this going to break my site?"
"What if my plugins stop working afterwards?"
"Will my site end up down for hours or days because of this?"
I‘ll let you in on a webmaster secret – PHP updates rarely go as smoothly as the hosts make it sound. Sure, they have good intentions to improve security and performance.
But too often, us site owners get left scrambling to fix the aftermath of a botched PHP upgrade.
Don‘t get me wrong. Staying current with the latest PHP versions is crucial for your WordPress site‘s health. But you need to go into this prepared for potential disruptions.
In this guide, I want to help you understand exactly how PHP changes impact WordPress. I‘ll also share all my tips to make sure your site sails through the next PHP update without issues.
Contents
Why PHP & WordPress Are Joined at the Hip
Before we get into the gritty details, let‘s quickly recap the relationship between PHP and WordPress:
- WordPress is an open source CMS built using the PHP programming language.
- PHP code runs on your web server to generate the actual HTML pages your visitors see.
- Without PHP, WordPress would just be static HTML files.
- PHP provides all the dynamic functionality – admin, plugins, themes, comments, custom fields etc.
So in essence, PHP acts as the bridge between WordPress (the software) and your web host‘s server environment.
When your host updates the PHP version, it directly impacts how WordPress communicates with the server.
This reliance on PHP is the root cause of potential disruptions from PHP changes.
But why exactly do hosts put us through the wringer of PHP updates in the first place?
The Never-Ending Upgrade Cycle of PHP Versions
PHP undergoes constant development by its open source community. New PHP versions aim to fix bugs, close security holes and add useful features.
Typically, newer PHP releases offer significant improvements in:
- Speed – Faster processing of scripts.
- Security – Bug fixes and safety enhancements.
- Standards compliance – Better support for modern web frameworks.
For example, PHP 7 was a major leap forward from PHP 5. It provided huge performance gains and coding improvements:
This constant evolution is crucial for PHP to keep pace as a modern server-side language.
However, it also creates challenges for backward-compatibility.
As hosts adopt newer PHP versions, it can expose compatibilty issues with older PHP code still running on sites.
Now you can see why WordPress can potentially break after a PHP upgrade initiated by the host.
It‘s not always WordPress core itself that‘s the problem. Usually, it‘s…
Outdated Plugins, Themes and Custom Code
The WordPress development team works hard to ensure every new release supports the latest PHP versions.
So generally, WordPress core should function properly after a PHP update on the host‘s servers.
Where things tend to fall apart are outdated plugins, themes, and custom code running on the site:
-
Plugins – Many free plugins are abandoned and never updated. The old PHP codebase eventually stops working on newer PHP versions.
-
Themes – An outdated theme may use PHP functions that have been removed or deprecated in the newer PHP release.
-
Custom code – Snippets like custom widgets or site integrations written years ago in older PHP.
I recently experienced this myself when my host upgraded from PHP 5.6 to PHP 7.2:
Two outdated plugins stopped working completely. An ecommerce plugin written years ago threw fatal errors. And a custom integration we had coded in-house crashed the home page.
So while the WordPress core handled the update fine, all the additional code running on our site exposed the compatibility issues.
We ended up having to scramble for almost two weeks to fix all the problems before our traffic recovered.
Let me tell you – I quickly learned what not to do during a hosting PHP upgrade ever again.
Here are the steps I now take to make sure everything goes smoothly.
How to Prepare for an Upcoming PHP Update
When your web host first warns you about an upcoming PHP update, don‘t ignore it.
Here are 5 essential tasks to perform ahead of time:
1. Audit Your Plugins and Themes
Don‘t assume that plugins and themes from the WordPress directory will work with the new PHP version.
Go through your entire list of installed plugins and themes and check:
- When was it last updated?
- Does the developer actively maintain it?
- Are there any reported issues about compatibility?
Anything that hasn‘t been updated in over 2 years is riskier.
I like to setup a staging copy of my site and test higher-risk plugins manually by triggering fake PHP updates.
This reveals any plugins and themes that need to be replaced or removed before the actual migration.
2. Review All Custom PHP Code
Scour your site for any custom PHP code that may break under the new PHP version:
- Plugins you‘ve modified
- Snippets in your theme‘s
functions.php
file - Standalone custom widgets, shortcodes or site integrations
Test this code thoroughly on a staging server before deploying the PHP update on production. Address any issues ahead of time.
3. Enable Caching
A well-configured persistent cache can keep your site running smoothly during brief PHP disruptions.
Static cached pages will continue serving to visitors even if certain PHP functions stop working temporarily after the update.
Just make sure to clear the cache once everything is stable again.
4. Communicate Closely with Your Host
Don‘t let the first warning from your host be your last communication with them about the PHP update.
Reach out to their support team with any concerns. See if you can get early access to test servers with the new PHP version.
If possible, request that they initially push the update only to staging sites before touching production servers.
This gives you a chance to identify and fix potential problems with real-world testing before it impacts traffic.
5. Have Backups and a Rollback Plan
I cannot stress enough how essential a complete backup is before any major server change.
Make sure you have:
- A recent database backup
- A complete file system backup
- Backups of any customized code
This gives you the ability to easily rollback if something goes horribly wrong.
Also have a plan for how to efficiently restore your site from backup if needed.
Following these preventative measures will help you avoid 99% of potential issues from a hosting PHP update.
But…things don‘t always go according to plan. So you also need a game plan if your site does break.
How to Troubleshoot WordPress Problems After a Botched PHP Upgrade
No matter how much you prepare, sometimes a problematic PHP upgrade still happens.
When your WordPress site suddenly starts showing errors after a PHP update, here are some smart first troubleshooting steps:
Switch to a Default Theme
Activate one of the default WordPress themes included in core, like Twenty Twenty.
This will reveal if your theme is the culprit versus a plugin or code issue.
Review Debug and Error Logs
Look for any PHP warnings, notices or fatal errors in your debug.log and error logs pointing to the root cause.
See if a specific plugin, theme or function is generating recurring PHP issues.
Toggle Plugins Off One-by-One
Systematically deactivate your plugins one-by-one until you isolate which one(s) trigger the problems.
Then reach out to that plugin‘s support for help updating to be compatible.
Use Staging for Testing Fixes
Before messing with files on your live production site, test changes and fixes on a staging environment first.
Once you‘ve resolved the issues safely on staging, then push the fixes live.
Contact Host Support ASAP
Don‘t wait too long to rope your host‘s support team into troubleshooting the PHP problems.
They have experience fixing similar issues for other customers that can help resolve it faster.
Rollback to a Backup
If you‘ve exhausted all issues fixing the root cause, roll your site back to a pre-update backup.
Then migrate to a more capable host that can handle PHP updates better.
Following these tips will help isolate and fix problems much quicker after a bad PHP upgrade.
The good news is that once you get past the initial hurdles, your site will be in much better shape.
Don‘t Forget the Long-Term Benefits
I know I‘ve painted a gloomy picture about the disruptions PHP updates can cause.
But in the long run, staying current with the latest PHP versions provides:
-
Better performance – Newer PHP builds typically run scripts faster. This improves site speed.
-
Enhanced security – Upgrading closes security loopholes and applies latest protections.
-
Improved compliance – PHP updates keep your site adhering to web standards.
-
New features – You gain access to helpful new PHP functions and improvements.
So short-term pain during the upgrade leads to long-term gain in site health and speed.
Just make sure you take the necessary precautions outlined in this guide. Testing thoroughly, auditing code, communicating with your host, and having a troubleshooting game plan.
This will ensure you smoothly sail into the waters of the latest and greatest PHP version – allowing your WordPress site to thrive for many years ahead.
Let me know in the comments if you have any other tips and tricks for safely navigating PHP updates. I‘m always looking to improve my own hosting upgrade processes.