When you upgrade PHP you may find that the new website doesn't work. That is very likely due to the code in your website trying to access features that have either been changed or removed from the new version of PHP that you are using.
This kind of problem is much more likely to happen when you switch between major versions of PHP, ie if you go from PHP 5.6.0 to 7.0.0.
Switching between minor version numbers (the second part of the three part php version number) can also produce such problems, however it is less common and the changes required to your website in order to resolve the issues will probably be minor and quicker to make.
Switching between build versions (the third part of a php version number) should likely never produce such issues.
How to keep on top of updates and make them as painless as possible
At the end of the day you need to keep PHP up to date for all the reasons we have explained elsewhere on this website. Regular updates will make the process much less painful than say a once every four years when you are much more likely to experience a significant issue upon updating. Keeping your website and server constantly maintained will reduce down time and the likelihood of nasty surprises, when you suddenly realise that your PHP is out of date and vulnerable and then discover that on top of this the site completely fails to function under currently supported versions of PHP.
Remember to sign up for our notification service in order to stay on top of the latest PHP updates. Ideally, also setup a hidden copy of your website on your web server that you can use for testing new versions of PHP. This will allow you to see ahead of time what problems if any arise when you upgrade the version.
I don't even get errors, my website is just a white page!
This is quite common. In a production environment it's normal for PHP to be set up to not show errors when it encounters them. This can result in your webpage failing to render and the result being just a white empty web page. If this occurs you should enable debugging in PHP. However this ideally wouldn't be done on the live site. If you get this white page, revert to the previous PHP version that worked and then set up a duplicate hidden website that you can use to troubleshoot the problems encountered on the newer PHP version.
How do I safely test my website on a new version of PHP?
As mentioned above, testing with a copy of your site is a really useful way to troubleshoot problems. It means that you can mess around with the site, experimenting with different PHP versions in a controlled manner with no down time or problems occurring on the live site that your visitors view.
How to best set up a copy of your website depends on your web hosting. It may come with a
development or
staging environment of some kind. The only way to check that is by asking your service provider.
If your provider doesn't provide any such service the best thing to do is copy your entire website to a different location. You could do this on your own computer or a remotely hosted web server. Ideally this would be on exactly the same environment as your live website. This way you rule out any issues in the differences that are likely to exist between two separate web server environments.
To set up a copy of your website you likely need to undertake the following core tasks:
- Copy all the files for the website to the new folder on your web server
- Assuming your website needs a database in order to function, create a new database and then copy all the tables from the live database into the new database.
- Make any configuration changes required for the new preview copy of the website to understand that it is running at a different url.
- Do something to completely hide the copy website from the public internet. This could either be setting up a password protected folder for the root of the new preview website or just hiding the website from search engines by using the robots.txt file.
Article last updated: 23rd May, 2021