WordPress How to Upgrade to PHP 7.2 safely
There are many reasons you should be using PHP 7.2 rather than an older version, though security and performance probably top the list.
In terms of security, if you are using a version prior to 5.6 this is already End of Life (EOL). In short, this means that unless you are using a hardened version of PHP, your application is vulnerable to any number of exploits that are out in the wild (your site is likely to get hacked). If you are using PHP 5.6 this is EOL 31st December 2018 and PHP 7.0 is EOL 3rd December 2018.
If upgrading to improve security hasn’t got your attention, the performance improvement certainly will! In the table below from phpbenchmarks.com, you can see that there is a significant performance improvement when using PHP 7.2 compared to 5.6.
I’m sold, what next!
So now that you’ve decided you want to upgrade to PHP 7.2, how do you do it? Fear not, the steps outlined below describe how to safely upgrade to PHP 7.2
Back up your live website
There any number of ways to backup your website, plugins, FTP, command line etc. All our servers have cPanel installed, you can follow this guide to backup your WordPress site using cPanel.
Create a staging copy of your website
You can either do this manually by copying the files and database to a subdomain or by using an automation tool. Clook customers can use Softaculous to clone their site by following this guide.
Upgrade all plugins and your WP install on Staging
Before you switch to PHP 7.2 you should ensure all your plugins have been updated along with the core install of WordPress. If you have any plugins that have not been updated in a while, these are unlikely to work as the code would not have been updated to be 7.2 compatible.
Switch to PHP 7.2 on Staging
You can now switch to PHP 7.2 on your staging site. Clook customers can do this by following this guide
Test Staging site fully
You should now fully test your staging site.
– Check all pages
– Check all active plugins are working as expected
– Check all your theme’s functions
Upgrade your live site to PHP 7.2
Once you have confirmed that the staging environment works, you should upgrade all plugins and WP core on your live site and then switch to PHP 7.2
Will’s our technical sales guy from the hills of Rossendale. In his spare time he can be found designing and building websites, or doing a spot of DIY!