Get an overview and checklist of the steps needed to ensure your WordPress site has a smooth transition to PHP 7.
Why You Need to Switch to PHP 7
PHP is the coding language that is at the core of:
- WordPress
- Plugins
- themes
Like all coding languages, it evolves.
PHP versions below 5.6 are no longer supported.
The latest version of PHP is 7.x
Running below PHP 5.6 puts your site at risk for:
- Bugs
- Breaks
- Security breaches
PHP 7 is Faster and More Secure
Every entity involved with your website desperately wants you to upgrade and make the switch to PHP 7.
Those pushing for PHP 7 include:
- WordPress developers
- Plugin and theme developers
- Host providers
- Site security providers
Backwards Compatibility is Holding Up Progress
WordPress has always been sensitive about remaining backwards compatible.
Unfortunately, developers abandon plugins and themes and they fall further and further behind in staying up-to-date.
Plugins and themes need to remain current with:
- PHP
- WordPress
- Javascript
- And more
Due to ever evolving security, performance, and usability standards, WordPress can only remain backwards compatible for just so long.
At some point even WordPress has to cut off support for older coding languages that are no longer being supported themselves.
Upgrading to PHP 7 is not optional!
At some point, everything on your site is going to cut off support for lower PHP versions and break.
It’s not if, but when.
Get Through the Transition Smoothly
There are two main hold ups to everyone making the switch to PHP 7.
- Most site owners don’t know about it.
- Too many older plugins aren’t compatible.
To help more folks become aware that they need to switch, Joost de Valk placed a nag notice in his Yoast SEO plugin.
It displays the nag if it detects a PHP version below 5.6.
WordPress itself will likely include a similar nag in the near future (this rumor has been floating since July 2017).
WordPress is also actively encouraging plugin and theme developers to get on the bandwagon and get their code up to PHP 7 and current WordPress coding standards.
And that’s the rub.
Some plugins and themes are up to date, some aren’t.
So, we site owners are in a fuzzy transition period.
Check Your Plugins and Theme First
Before you make the switch, you need to check to see if your plugins and themes are compatible with PHP 7.
TAKE: The Seriously Old Plugin Challenge
It is a guide for how to check your plugins and lists some older ones that may require switching to an alternative.
We found plugins that have not been updated in 9 years!!
They present a serious security hole on your site.
Some plugins will throw false warnings and errors during the check.
The checker has a link to a whitelist of plugins that throw false errors, but not all plugins are on it.
Plugins like KingSumo Giveaways gave 22 errors. I checked with the devs and the errors are because they are keeping the plugin backwards compatible. Put the assured me it is PHP 7 ready and I have confirmed that on a site that has been switched.
Check Your Host’s PHP Switcher
Many hosts have an easy way for you to switch your PHP version yourself via cPanel.
If your host does not have that switcher, then check with support to see how to upgrade your PHP versions.
Read on for more notes on host and upgrade notes.
Caveats to Watch Out For
Following are a few items you may run into when switching PHP versions.
Multiple sites in one cPanel account
Be aware that on shared hosting, switching the PHP version will change it for the entire account, not just one site. So check them all.
If you’re on VPS, you may have a multi-switcher available where you can control the PHP version on each site.
Security note: If you’re still running multiple site under one cPanel, you’ve got a slew of other security and performance issues now too. This practice went out of vogue in 2013 and the risk to your site and hosting account has grown every year since. Contact me for details.
PHP 7 not available on some shared hosting
If you see 5.x versions of PHP listed, but not 7, it’s likely that you’re on an older server that has not been updated to the latest Apache version. Check with support to learn your options. It’s likely they will want to migrate your site to a newer server.
READ: How to Migrate Your Site to a New Host
Even though you’re staying with the same company, you’re still moving to a new IP address. Your site will be affected as if you were moving to a new host.
No PHP 7 or Switcher on VPS
Unlike shared hosting where you may have to move to another server, Apache on your VPS account can be upgraded.
That also means that it will need to be recompiled. And that could disrupt your site’s availability for 20-30 minutes.
So, ask your host to do it at an off-peak traffic time, but be careful! Don’t run it in the middle of the night because it could cause unexpected issues and you want to be available to check your site after the update. See more notes below.
Breaks Caused by PHP 7 Upgrade
Besides themes and plugins, there may be other files on your hosting account that are not compatible with PHP7, and that no checker plugin can find.
Check all .htaccess files
Many hosts include an Add Handler PHP directive in the .htaccess file. This is how your site knows which PHP version to use.
Check all php.ini files
The directives in this file are specific to how PHP functions on your site. Each host has their own directives. So, if you’ve used several hosting companies, and/or your site was originally set up years ago, there’s no telling what’s in that file. And some of it may not be compatible with PHP 7.
You may have multiple .htaccess and php.ini files!!
Places to look for .htaccess and php.ini files:
- host root
- public_html root
- add-on domain folders
- sub-domain folders
- sub-directory folders
- all WP core file folders
What if My Site is not PHP 7 Compatible?
You should be on PHP 5.6 at a minimum.
So, at least test and switch up to that.
It’s likely nothing on your site or hosting account will have trouble with 5.6. But do test first.
If you need time to make plugin or theme changes, or other file changes at your host, switching up to at least 5.6 will buy you that time.
But keep this project on your plate. As mentioned, PHP 7 will not be an optional upgrade for long.
There are LOTS of WordPress changes coming and you want this step behind you.
Do I Switch to PHP 7 or 7.1 or 7.2?
Try PHP 7.0 first and check your site carefully.
If all is well, then jump to the latest version available and check the site again.
Be sure to purge all cache first, including your local caching plugin, Cloudflare, and your browser. Use an incognito window while logged out, just to be extra sure you are seeing the latest changes.
Need Help?
If you have one site on a shared hosting account (and no add-on domain folders), and you’ve run your theme and plugin checks, and your host has a PHP switcher with PHP 7 available via cPanel, you’ll likely be okay to do the switch yourself.
If you have multiple sites, older .htaccess and php.ini files, and/or are on VPS, you may need more help with the switch.
Contact me to check your installation and get you through the PHP 7 switch smoothly.
Thanks for the info.