Change can be scary and any change to how your website works can be scarier. Recently PHP 5.6 and 7.0 have come to their end of life. Websites are being updated to the now current standard 7.2. At innov8place, we’ve been asked plenty of questions about this update. The two most common are: what can be done to prepare for, and how to fix things if PHP 7.2 breaks a website.
How Do You Prepare For PHP 7.2?
Taking the time to make sure all parts of a website are updated and compatible with the new PHP will save everyone from a lot of sleepless nights. We recommend three core actions before executing the update.
1) Check Your Version of WordPress
Don’t think that if you update one, you won’t need to update the other. Having an outdated WordPress site try to run an up to date PHP is a clear path to disaster. Is your website is running off WordPress 4.9.3 or later? If not, you will need to manually update to the newest version. For Pressable customers with managed WordPress hosting, know that you’ve already been updated to the most recent version of WordPress.
MAKE SURE A BACKUP OF YOUR CURRENT SITE IS MADE BEFORE MAKING ANY CHANGES. That way if any issues occur from updating WordPress, you can reload that backup and figure out the problem. Once WordPress has been updated you can move onto checking everything else.
2) Check Themes and Plugins
This step can be a little more tedious than the first. You’ll need to look through both of these to make sure that they are running on up to date versions. If there are any updates available, make a backup, then complete those updates.
Keep an eye out for any plugins that have not received an update within a year. It is incredibly likely that these are not compatible with PHP 7.X and will ultimately break your website. Another thing to pay attention to is themes/plugins that have paid licensing that are expired and haven’t updated.
Now with this all sorted, you can find alternative plugins for those that are outdated, and then move onto checking the last part of your website.
3) Review Any Customizations
If you had a developer make a custom theme or plugin for you, we recommend getting in touch with them to review if it will be compatible with the update. If not, you will most likely have to review an alternative option so that your website will run smoothly once updated.
With these preparations in place, you are about ready to make the switch over to 7.2. From here you can actually test to see if your site will run on the new PHP. WordPress allows for a live site to be made into a staging copy. So, backup your live site, copy it into a staging site and test out PHP 7.2. If all goes well, you are good to upgrade your live site!
“But wait!” you might exclaim, “I wasn’t able to make preparations for the update and now everything is broken! How in the world can I fix this?”
How Do You Fix A Site When PHP 7.2 Breaks It?
The first step here is, don’t panic. None of the errors that caused this are any that can completely wipe your website off of the face of the internet. In most instances, one of the three items listed above is responsible. If you have a backup from before the update when live on the site, great! Reload that backup and work from there. No backup? Consider this a valuable learning opportunity to the importance of doing so before updating core code.
1) Update WordPress
This step isn’t any different from earlier. Make sure WordPress is up to par before moving on. Complete the manual update and check your site. Is it working now? Great, you’ve probably solved the issue. To be on the safe side, we suggest you make sure everything else is updated. If your is still not working, continue to the next step.
2) Deactivate all Plugins
A deactivated plugin isn’t a deleted one. You’ve simply paused the interaction between the plugin and your site. Once you’ve done this, go check on your site. If things seem to be running smoothly, skip the next step.
3) Change to the Default Theme
Outdated themes can cause a lot of issues. Temporarily switch your site to the standard WordPress theme to allow PHP 7.2 to get along with your website. After this, your site should be running fine, although it’ll look a little different. Log back into the admin side of WordPress to continue.
4) Update Everything
Yes, everything. All plugins and themes. Be sure to check if you need to remove anything that you don’t need or hasn’t been updated within a year.
5) Activate Plugins and Themes
Once everything is updated and unneeded items are gone, start turning things back on one-by-one. Be sure to check your site after every change to make sure it’s still in working order. If your site breaks after a specific change, you caught the culprit red-handed! Deactivate it once again and search for a replacement as it is no longer compatible with PHP.
You might be wondering if updating PHP is actually worth all of this. Why make a change to your site if it might break it? In short yes, it is. Ultimately sticking to older versions of PHP will inevitably cause much bigger problems than compatibility errors. Avoiding updates and choosing to keep an older version of PHP is allowing your website to run unsupported without any security. Just remain calm, it’s a lot easier than it seems. If you’re hosting with Pressable, then don’t worry. We’ve updated to PHP 7.2 and are proactively working with sites to ensure there aren’t any breaks. If you aren’t, follow the steps, just breathe, and don’t be afraid to ask for help. You have resources.