All Kinsta clients can easily update and or change PHP versions for each WordPress site individually within the MyKinsta dashboard. Currently, we support PHP 8.0, 8.1 and 8.2 for sites hosted on Kinsta.
We highly recommend PHP 8.1, or the latest version, 8.2, 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 (EOL).
Not only will we be adopting PHP’s official schedule, but as of 2020, the end-of-life for the oldest version of PHP on the Kinsta platform will always be November 1st. This will allow you and our team to upgrade everyone before the holiday season (Black Friday, Cyber Monday, Christmas, etc.).
Why Update the PHP Version of Your WordPress Site?
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 each version, we’ve seen increasing performance improvements over the previous version.
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 to Update PHP Versions in WordPress
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 WordPress environment right away, you can skip down to Step 5. 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 7.4.
- Create a Staging Site
- Change PHP Engine
- Test Site, Plugins, Theme
- Push Staging to Live
- Update PHP on Live Site
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 want to update PHP versions on). Click on the Environment selector next to the site name, and select Staging from the drop-down menu, 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 PHP Version for WordPress
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 Modify button and select your preferred PHP version in the drop-down menu.
If you want to test a new PHP version first, make sure your WordPress staging environment is selected, not your live environment. We recommend first testing with PHP 8.0. If your site has problems, you can always contact our Kinsta support team at any time.
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.
(Suggested: Changing your PHP version can help you fix “The site is experiencing technical difficulties.” error in WordPress).
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 want 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 (501, 502, 503, 504, etc.) 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 are 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 Mode in MyKinsta
For Kinsta users, WordPress debug mode can be enabled right in the MyKinsta dashboard. Simply navigate to Sites > Tools > WordPress Debugging, and click the Enable button. This will allow you to see PHP errors and notices without having to enable debug mode via SSH or SFTP.
Our self-healing PHP feature automatically restarts PHP if it notices any issues. If you need to manually restart PHP for any reason, you can do so by going to your site’s Tools page and clicking Restart PHP.
Enable Debug Logging in WordPress
If you don’t have SSH or MyKinsta 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 the 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.4 (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 8.0 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.4, then you might have to resort to this.
Step 4 – Push Staging to Live
Once you have finished testing your site with PHP, if you had to make any changes to your plugins or themes, you can either push staging to live or make the same changes to the live site that you made to the staging 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.
Step 5 – Update PHP on Your Live Site
Now that it’s ready for PHP to be updated, you can change the PHP version on your live site just as you did in Step 2 above (Tools > PHP Engine > Modify > select your preferred PHP version).