PHP Version and Upgrade Guide
When it comes to security and speed, upgrading PHP versions is a straightforward and invaluable way to “Press Ahead” of your competition. We recommend using our PHP Test Driver to preview their site on a new PHP version. Once that compatibility check is complete, you can simply select your desired PHP version with the PHP Selector tool. No migration required. It’s as simple as that!
About PHP Upgrades
PHP is a flexible web development language that WordPress, and many other web platforms, run on.
PHP is managed by a third party team of developers from around the world who maintain, update and correct the language in stable version releases.
Upgrading your PHP is a lot like updating plugins or themes; it makes your site perform better and run more securely.
Each PHP version is supported for 2 years after the initial release date, to receive improvements, bug fixes and security patches. After those first 2 years a PHP version will only receive critical security updates, as-needed. After 3 years, the PHP version is deprecated and no longer receives updates, making it not supported and insecure.
At WP Engine we want you to have the fastest and most secure WordPress hosting experience. One of the most easily changed factors to improve your site’s performance and security is the PHP version.
For example, in upgrading a website on WP Engine from PHP 5.6 to 7.2 we saw speed improvements of up to 40%. From 7.2 to 7.3 we saw as much as 15% faster page transaction times. With 7.4, we have seen around 10% performance improvement after upgrading.
Automatic PHP Upgrades
The EOL (End-Of-Life) process is a standard part of the release cycles of PHP (the open source programming language which powers WordPress). Once a version has reached “end of life”, PHP ceases to provide security support for it and it is no longer secure enough to remain on WP Engine servers.
For security purposes, WP Engine completely removes older versions of PHP from our servers once they have reached “end of life”. At this time, if your website is using an older version of PHP, it will be upgraded to a newer version automatically.
Our team will notify you via email several times before this automatic change occurs. We highly recommend updating as soon as possible when a new PHP version is released to ensure your site is receiving performance benefits as well as to ensure you can perform the upgrade in a suitable window for your needs. Automatic PHP upgrades cannot be deferred.
Supported PHP Versions
7.3 (EOL November 2021) 7.4
If a new PHP version is not available for your environment, it will be soon. We roll out all new versions slowly to the WP Engine farm as a security precaution. If you’d like a new version more quickly, a migration may be necessary. In most cases it’s considered easiest to simply wait for the rollout process to complete.
View Current PHP Version
There are several options to check the current PHP version on a WordPress website:
- The easiest way to see the PHP version on an environment is to view the current setting of the PHP Selector
- Use a plugin such as Display PHP Version to show the current PHP version from within the WP Admin
- Create a PHP Info page for the environment (more details below)
PHP Info Page
A phpinfo page can be used to view the current PHP information for your environment. This can be useful for debugging PHP related issues while developing or maintaining your WordPress site.
- Create a file using a text editor on your computer
- We recommend you name this file a random string, for security purposes.
- The file must be saved with the .php extension.
- Paste either of the following file contents into this new file and save it:
If you need to know PHP version information:
<?php echo 'Current PHP version: ' . phpversion(); ?>
If you need to know information about which PHP modules are loaded:
<?php phpinfo(INFO_MODULES); ?>
- Connect to your site using SFTP
- In the root directory, drag and drop the newly created file
- In your browser, type your domain followed by your filename string
It is highly recommended to delete the file as soon as possible after use, for security reasons. Leaving this file on your site can create an unintended vulnerability by publicly exposing the server’s PHP configuration.
Test PHP Version
There are several options for testing prior to upgrading a live site. You can perform one or all of these options, as desired, to ensure your website’s success.
- Use the PHP Test Driver
- Copy to a Staging or Development environment and upgrade PHP independently
- Each environment can have a different PHP version using the PHP Version Selector
You may see some “Deprecation” notices in your Apache error logs following your PHP upgrade. In this sense, “deprecated” refers to PHP features that are being replaced by different, updated features. With every new PHP version, there are some deprecated functions and elements. These aspects of your website will work for now, but will be removed in later versions of PHP, giving developers time to update their code. You can find a list of deprecated features, as well as their recommended modern solutions, on the official PHP website.
PHP Test Driver
The PHP Test Driver can be used to view your website on a different version of PHP. This test driver only impacts the user who has initiated the test drive session. Other visitors continue to see the site as normal without disruption.
Enable PHP Test Driver
- Log in to your User Portal
- Select the environment name you’d like to test
- Click Preview site
- Log in to your WordPress admin dashboard when prompted
- You will see a banner at the top of your screen:
- Click through each element of your website that you would like to demo on this version of PHP to test functionality
For best practices on testing the compatibility of your sites with a new version of PHP, please see our recommended developer workflow. We have a separate workflow available for those who are not yet on the Sites Experience.
Disable PHP Test Driver
A cookie is set in your browser that will continue to show the site in the selected version of PHP. This cookie will expire after a day on its own or if you close the browser.
If you need to disable the Test Driver manually, there are three options:
- Click the link within in Test Driver banner in your WordPress admin dashboard:
- Delete a cookie from your browser called: wpengine_php
- Delete all cookies from your browser
Change PHP Version
Changing PHP versions is quick and easy, requiring no technical knowledge. The change is in-place meaning there is no migration, no downtime and no DNS updates necessary. Changing PHP versions is easy and free for all plan types.
PHP versions can be different across environments (excluding legacy staging which must match live). This means you can upgrade your environments as they’re ready to go. Keep in mind that PHP version is not copied when copying environments.
An environment can be upgraded or downgraded between any of the available PHP versions as-needed. Once a version is retired from WP Engine servers your website will be automatically upgraded to a newer version. We recommend upgrading to each new version of PHP as soon as possible.
There are two locations you can use to change your PHP version using our PHP Selector: Overview page and Sites page.
Overview Page PHP Selector
- Log in to the User Portal
- Select the environment name you’d like to modify
- Within the Environment Stats section, locate PHP Version
- Click the PHP Version number, in purple
- Select a PHP version
- Click Change PHP Version
Site Page PHP Selector
If you’re looking to change the PHP version of several environments more quickly, this can be done from the Sites page in your User Portal.
- Log into the User Portal
- Click Sites
- Locate the environment name you wish the change
- Click the PHP version number next to the environment
- Select a different PHP version
- Click Change PHP version
Troubleshoot PHP Errors
In some cases, a PHP upgrade may break your website. If the previous version of PHP is still available on the server, the PHP selector can be used to switch back temporarily. We highly advise reaching out to your plugin/theme authors or a developer for guidance resolving errors, as switching to an older PHP version is not a permanent solution.
- Copy to staging/development environment
- On a test environment, upgrade plugins, themes and WordPress core files
- Many premium themes and plugins will not show an update available in the WP Admin, so be sure to check with the author directly.
If you still have issues, you will need to start ruling items out in order to locate the culprit:
- Disable plugins one at a time
- Enable a default theme
- Reinstall default WP Core files
- Test with a default .htaccess file
Additional troubleshooting options:
- Accessing PHP error logs
- Understanding PHP error messages
- Resolving a 500 internal server error
- Troubleshooting using SSH Gateway
Need development help?
WP Engine Consultants – Directory of well-known WordPress consultants.
If you still need guidance for determining which item(s) may be causing errors, reach out to our Support team.