All Kinsta clients can easily update and or change PHP versions for each WordPress site individually within the MyKinsta dashboard. We highly recommend PHP 7.3 as it’s much faster, resource-friendly, and more secure than its predecessors. In fact, it’s shown to be 3x as fast in some configurations, as seen in our PHP benchmark reports.
As you may have heard, PHP has moved to a predictable release schedule. Each new version is actively maintained for 2 years and receives an additional year of critical security updates. To make sure your WordPress sites are as fast and secure as possible we have adopted the same schedule which means that we will be removing unsupported versions of PHP when they reach end-of-life.
On December 9th, 2019 we will be removing PHP versions 5.6, 7.0, and 7.1 from MyKinsta. For any websites using any of these versions of PHP, you will need to upgrade to at least PHP 7.2.
- Why Update Your PHP Version?
- What If My Site Breaks?
- How Long Do I Have?
- How to Safely Update PHP Versions (Steps)
Why Update Your PHP Version?
The two main reasons are security and speed.
Just as you upgrade WordPress itself to make sure you are protected against security vulnerabilities, you should do the same with PHP. In addition, upgrading PHP produces a significant speed increase. PHP 7.0 was a huge leap forward – more than doubling performance compared to 5.6. With version 7.3 we have seen another 20% – 25% increase compared to 7.0.
For additional details, check out our article on supported PHP versions.
Not sure what version of PHP you’re running? You can check in the MyKinsta dashboard “Tools” menu. Or, if you’re running WordPress 5.0 or above, you can see the PHP version under the “Site Health” tool.
What If My Site Breaks?
Issues caused by updating PHP versions happen when code running on your site uses old functions that are no longer supported by newer versions of PHP. The culprit is likely to be a plugin or an active theme. Our guide below contains step-by-step instructions on how to troubleshoot this.
How Long Do I Have?
We will disable switching to PHP 5.6, 7.0, and 7.1 for Kinsta clients on live environments on October 1st, 2019. You will be able to switch to PHP 7.2 or 7.3 in live environments, but not back to PHP 5.6, 7.0, or 7.1. This change will apply to existing sites as well as to any sites created on or after October 1st, 2019.
Staging environments will not be affected on October 1st to make sure you can continue testing.
Sites running PHP 5.6, 7.0, or 7.1 will be automatically upgraded to PHP 7.2 beginning December 9th, 2019.
We apologize for any inconvenience this may cause you. We are dedicated to running the fastest and most secure environment on the market and that means that we need to make sure all sites are using technologies that are actively receiving security updates.
How to Safely Update PHP Versions (Steps)
Today we’ll walk you through the steps on how to best test your WordPress site for compatibility before updating PHP versions. Many of you shouldn’t experience any downtime and there will be little work required. For others, additional testing, troubleshooting, and even hiring a WordPress developer to make things compatible might be required.
If you simply want to update the PHP version on your live environment right away, you can skip down to Step 2. However, we strongly recommend following all of the steps below though to ensure everything works properly. Especially if you’re running an older version, such as PHP 5.6.
Step 1 – Create a Staging Site
The very first thing you should do is create a staging site. This is separate from your live environment and will allow you to test newer versions of PHP without breaking your live site.
In the MyKinsta dashboard, click on “Sites” in the left navigation. You will see a list of your sites. Click on the one you’d like to add a staging area to (the site you’re wanting to update PHP versions on). Click on “Staging environment” from the drop-down menu at the top right, then click on the “Create a staging environment” button.
Make sure to also check out the important notes regarding staging environments. For example, if you’re using a third-party CDN, you might need to disable it for your site to render correctly. This is because your staging site uses a different URL. Caching is also disabled on staging, so please keep this in mind if you are trying to test performance.
Step 2 – Update/Change PHP Version
To update your WordPress site’s PHP version, go to “Sites” and select the site you’d like to change the PHP version on. Then click on the “Tools” tab. Under “PHP Engine” click on the drop-down and select your preferred PHP version.
If you’re wanting to test a new PHP version first, make sure your staging environment is selected, not your live environment. We recommend first testing with PHP 7.3. If your site has problems, you can always revert it back to a lower version, such as PHP 7.2.
Once you select the PHP version you want, you’ll get a prompt. Click on the “Modify PHP version” button to confirm your choice.
This process may take up to 3 minutes. At the end of the process, your PHP engine will be restarted which may result in a couple of seconds of downtime for your WordPress backend only. Your site visitors will not experience any downtime.
While the PHP version is being changed you can navigate away from the above page but some actions like cache management will be unavailable until the new engine has been activated. You will receive a notification in the dashboard as soon as the change has been made.
Step 3 – Test Your Site, Plugins, Theme
You should now have a staging site up and running on the latest version of PHP (or the version you are wanting to switch to). The first thing you should do is simply browse and click around on your WordPress site to see if you notice anything broken.
If something is incompatible, such as a plugin or your theme, you might see a 500 error or white screen of death on the front-end of your site. In this case, the easiest and quickest way to determine what might be causing it is to disable all of your third-party plugins and re-enable them one by one. Remember, you’re on a staging site. So you don’t have to worry about breaking anything.
In your WordPress dashboard under the “Plugins” screen, select all of your plugins. Then select “Deactivate” from the drop-down and click “Apply.”
You can then re-enable them one by one, visiting your WordPress site each time. This will help narrow down what might be causing an issue. Don’t have access to your WordPress dashboard because of an error? No problem, check out how to disable plugins via FTP.
The exact same tests can be used with your WordPress theme. You can temporarily switch back to the default WordPress theme, such as the Twenty Nineteen theme.
View Log Files in MyKinsta
Perhaps you have determined which plugin or theme is causing the issue but not sure why? This is where your WordPress error logs can come in handy. Simply click into one of your WordPress sites and on the right-hand side click on “Error Logs.” You can view your error.log, kinsta-cache-perf.log, and access.log files. By default, it will show the last 1,000 lines. You can drag the slider across to see the last 20,000 lines.
Important: The MyKinsta logs tool doesn’t show debug info. If you need to view debug information, you can enable
WP_DEBUG as we’ll show you below.
View Raw Log Files via SFTP
You can see the completely unmodified logs in
/logs/ via SFTP.
Tail Your Log Files via SSH
You can tail the logs while you experiment on your site using SSH. This basically means you can watch the log update live while testing. All of Kinsta’s hosting plans include SSH access.
Show last 500 lines
tail -n 500 /www/sitename/logs/error.log
Watch the file live
Watch your error log file update on the fly.
tail -f /www/sitename/logs/error.log
For those of you with SSH access, WP-CLI can also be an invaluable tool.
Enable Debug Logging in WordPress
If you don’t have SSH access, you can always enable debug logging in WordPress. First, you will need to connect to your site via SFTP. Then download your
wp-config.php so you can edit it.
Find the line that says
/* That's all, stop editing! Happy blogging. */ and just before it, add the following (as seen below):
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );
If the above code already exists in your
wp-config.php file but is set to “false,” simply change it to “true.” This will enable debug mode and show everything in your
/wp-content/debug.log file. You will also see warnings and errors in your WordPress admin if they exist.
Important: Don’t forget to turn it off when you’re done as these files can get pretty huge very quickly.
Confused as to What to Look For?
There are thousands of plugins and themes out there, so, unfortunately, it’s impossible for us to list all the errors you might experience. Typically these occur due to code (functions, syntax, etc.) being incompatible with the version of PHP you’re using. However, here is an example of something you might see.
500: Fatal error: Uncaught Error: A semicolon (';') is expected here. in /www/sitename/public/wp-content/plugins/bbpress-shortcodes/bbpress-shortcodes.php:177
As you can see above, it’s pretty easy to quickly narrow down that it’s bbPress Shortcodes plugin causing a problem.
In worst-case scenarios, you might find that you have a compatibility issue with one or two plugins. If that is the case, here is what we advise:
- Update your plugins and themes to the latest version if you haven’t already.
- Reach out to the developer of the plugin or theme and ask them to add/fix support PHP 7.3 (or the current version you’re using). This is one reason we’re giving you a heads up before the phase-out dates!
- Find an alternative plugin that can deliver the same functionality and is compatible with the PHP version.
- Hire a WordPress developer to fix the issue.
- Change your PHP engine to a lower version and see if the plugin or theme then works. If it does, you could run on a lower version of PHP until the developer updates their code. We don’t recommend this as PHP 7.3 is faster and will remain supported for a longer period of time. But if there is something you absolutely need to run and it only works on PHP 7.2, then you might have to resort to this.
Step 4 – Push Staging to Live
Once you have finished testing your site with PHP, you can either push staging to live or make any necessary changes to the live site and then change the PHP version on your live site. Some of you may find that you have to make fairly exhaustive changes in staging to get the site running on a newer version of PHP. In that case, using the push to live feature will save you a lot of time.
To do this, make sure you have your staging environment selected. Then click the “Push Staging to Live” button.
Feel free to reach out to our support team 24/7 regarding concerns or issues with updating the PHP version on your WordPress site.