PHP7.2 Migration Guide
PHP 5.6 no longer supported
WordPress is written in PHP and version 5.6 recently reached end of life. This means that security updates are no longer being issued and therefore potential vulnerabilities could be found which will remain unpatched going forward.
We will soon be retiring servers with unsupported PHP versions.
Upgrading your website to PHP 7.2 is therefore a priority.
Migrating your site to PHP 7.2
You will need to carry out the following steps:
- Reduce the TTL on your live domain names down to 1 hour - do this a few days before completing step 10 to allow time for the TTL propagation to take effect.
- Reset all file permissions. This can be done using the Pendeo Plugin within WP-Admin, or using our Control Panel > Tools section.
- Update WordPress Core to version 5.1 (WP version 5.2+ requires PHP7.2). *
- Review the PHP Errors log for your website and fix any errors.
- Download, install and run the plugin "PHP Compatibility Checker". Run a compatibility check for PHP7.2.
- Update your wp-config.php to define('DB_HOST', 'mysql-cluster1');
- Review any issues found by the compatibility checker. Confirm that these issues are resolved by updated versions of your plugins and theme. TIP review the suppliers' change logs. For any plugins / theme for which the compatibility checker finds errors, you have two options:
- If the item has an upgrade which makes it compatible with php7.2 - temporarily deactivate the plugin whilst you complete the upgrade.
- If the item is not fixed or compatible with 7.2 you'll need to find an alternative solution. In any case, you must deactivate the item permanently.
- View your site temporarily on PHP7.2 - see below for instructions. Click through each page and check that everything works as expected. NB if you have deactivate plugins in step 7, some functionality will not work as expected.
- When you are sure everything is working OK, remove your local hosts entry (created in step 8)
- Update DNS to point to the new PHP7.2 host.
- Wait for the DNS to propagate - test that your local environment has the updated record before proceeding.
- Take a backup and also download the wp-content/plugins and wp-content/theme directory via sFTP.
- Update WordPress Core to the latest version *
- Review the PHP Errors log for your website and fix any errors.
- Browse the site and check that it works.
- Repeat steps 13 to 15 for all plugins and then for your theme.
- Re-activate any temporarily deactivated plugins from step 7 - repeat steps 14 to 15.
- Migration complete.
- [optional] Change your TTL back to its previous setting.
* It's possible that updating your theme, plugins and/or WordPress core version will cause your site to break. Follow the instructions below about 'Resolving Errors'
Need Help?
If you need help or would simply prefer us to take care of the details for you, then please contact us about our managed migration service.
Resolving Errors
During the above steps where you update WordPress Core, Plugins or your Theme, you may encounter an error.
- If you find an error and can't identify the exact cause, it can be useful to deactivate all plugins, and confirm that this resolves the error. Then selectively activate one plugin at a time, checking to see whether enabling a particular plugin works as expected or reproduces the error.
- If the error is not identified, try switching to a different theme temporarily.
- If you're unable to access your WordPress Admin area at all - you can use sFTP to selectively deactivate plugins / themes until you are able to gain access.
What if there's still a problem?
If you can't fix the problem by selectively disabling plugins and themes, there may be some custom code causing a problem. Check the results of the PHP Compatibility Checker to see whether it offers any clues. You may need to upgrade your theme, move to a new theme or contact a developer for support.
How to Temporarily View Your Site on PHP7.2 Server
- Identify the IP address for the PHP7.2 server hosting your website - this article explains how.
- Set your computer only, by updating your local hosts file, to point to the PHP7.2 server
- Flush your DNS cache
- Open a command prompt or terminal and perform a ping to check that your hosts file entry is active. TIP you should see the same IP address as the one you put in your hosts file. If you don't - carefully repeat from step 3 above.
- Restart your web browser and visit your website - you should now be viewing your website on the PHP7.2 server.
Warning: Do not be tempted to upgrade WordPress at this stage as it will break your live site