As PHP 5.6 security support will expire on 31st December 2018, all websites which use PHP 5.6 version will be exposed to the security vulnerability. If your server still uses PHP 5.6 then you should also quickly decide and upgrade it latest PHP stable version (PHP 7.2).
One more reason to upgrade to PHP 7:
Other than a security issue, there is one more good reason to upgrade your website to PHP 7 and that is speed. As per Benchmark result on WordPress, it has shown a 200% increase in performance by just switching from PHP 5.6 to 7.
Also, WordPress also recommends to use only PHP 7.2 or greater. Hence, let’s not have any second thought and start upgrading your WordPress website to PHP 7.
Step 1: Setup Staging From Production
If you don’t have a staging setup of your website then don’t try to switch PHP version on production server as this will break your live website because of many depreciated functions in PHP 7. You can setup new staging server and have exact copy of production on staging server. If you cant afford new staging server then you can setup it on your localhost using WAMP or XAMP.
Step 2: Upgrade WordPress to Latest Version
Step 3: Upgrade all plugins & themes to Latest Version
Step 4: Check compatibility of your custom code on plugins or themes for PHP 7.
Step 5: Fix custom code to make it compatible with PHP 7.
This will be more time-consuming step than others if you have done many customizations on your wordpress website. For ex., if you have created a new custom child theme or created many custom plugins for custom functionality of your website.
Now, you have to check compatibility of your custom code for PHP 7. You can use below tool to do this.
- PHP7CC (no longer supported but still works): https://github.com/sstalle/php7cc
- PHP Compatibility Checker: https://wordpress.org/plugins/php-compatibility-checker/
- phan / phpstan
This tool will scan codes from themes, plugins, custom codes etc and will list out all errors & warnings. You need to find compatible solutions for these errors & warning and need to upgrade each of them.
Step 6: Test your website
Step 7: Take the backup of files & database of your live website
Step 8: Upgrade WordPress & all WordPress plugins on your live website
Step 9: Move all your custom code related changes to live
Step 10: Test your live website
This post was last modified on March 21, 2020 2:44 pm