PHP Compatibility Checker

Popis

The WP Engine PHP Compatibility Checker can be used by any WordPress website on any web host to check PHP version compatibility.

This plugin will lint theme and plugin code inside your WordPress file system and give you back a report of compatibility issues for you to fix. Compatibility issues are categorized into errors and warnings and will list the file and line number of the offending code, as well as the info about why that line of code is incompatible with the chosen version of PHP. The plugin will also suggest updates to themes and plugins, as a new version may offer compatible code.

This plugin does not execute your theme and plugin code, as such this plugin cannot detect runtime compatibility issues.

Please note that linting code is not perfect. This plugin cannot detect unused code-paths that might be used for backwards compatibility, and thus might show false positives. We maintain a whitelist of plugins that can cause false positives. We are continuously working to ensure the checker provides the most accurate results possible.

This plugin relies on WP-Cron to scan files in the background. The scan will get stuck if the site’s WP-Cron isn’t running correctly. Please see the FAQ for more information.

Update to PHP 7.2

Use this plugin to check your site for compatibility up to PHP 7.2!

As of November 2016, 52.9% of WordPress websites run a PHP version less PHP 5.5.

These versions of PHP have been deprecated and unsupported for over 9 months.

Only 3.4% of WordPress websites run PHP 7, the current main version of PHP.

Disclaimer

While this plugin is written to detect as many problems as accurately as possible, 100% reliable detection is very difficult to ensure. It is best practice to run comprehensive tests before you migrate to a new PHP version.

The plugin was created by WP Engine to help the WordPress community increase adoption of modern PHP versions. We welcome contributors to this plugin, and are excited to see how developers and other WordPress hosts use this plugin.

wp phpcompat <version> [--scan=<scan>]
<version>
PHP version to test.
[--scan=<scan>]
Whether to scan only active plugins and themes or all of them.
default: active
options:
- active
- all

Example: wp phpcompat 7.2 --scan=active

Obrázky

Main screen: compatibility checker options

Compatibility results screen

Inštalácia

Note: If you have WordPress 2.7 or above you can simply go to ‚Plugins‘ > ‚Add New‘ in the WordPress admin and search for „PHP Compatibility Checker“ and install it from there.

To manually install:
1. Upload phpcompat to the /wpengine-wp-content/plugins/ directory
2. Activate the plugin through the ‚Plugins‘ menu in WordPress

You will find the plugin options in the WP Admin Tools => PHP Compatibility menu. Once you click run it will take a few minutes to conduct the test. Feel free to navigate away from the page and check back later.

There are WP-CLI commands available see the Other Notes tab for details.

Časté otázky

Will this work outside of the WP Engine hosting account?

Yes, this plugin can be used any ANY WordPress website on ANY host.

Are there WP-CLI commands available?

Yes, this plugin does extend WP-CLI and provide commands. See the Other Notes tab for details.

A plugin I created is listed as not compatible, what should I do?

We maintain a whitelist of plugins that cause false positives. If your plugin shows up as incompatible but you think that is wrong, please open a GitHub issue on the project, or email wordpress@wpengine.com with info about your plugin and why you know it is compatible (you have automated tests, the failure is on backwards compatibility code paths, etc).

Some servers have timeouts to prevent long running queries, this is commonly 60 seconds. This can prevent the checker from being able to process large themes or plugins. You should check with your host to see if this timeout can be temporarily removed. The best way around this timeout issue is to run this plugin on a local copy of your site, or you can use the WP-CLI command.

You can use the filter wpephpcompat_scan_timeout to customize the scan timeout. See this for an example.

Setting the timeout to 0 disables the cron/timeout.

The scan is stuck, what can I do?

The PHP Compatibility Checker relies on WP-Cron to process plugins/themes in batches, this is necessary to avoid server timeouts. The scan will get stuck if your site’s WP-Cron isn’t functioning. You can look into this using WP Crontrol. The cron is called wpephpcompat_start_test_cron. This could also be an issue if your site is using basic authentication.

You can also use the WP-CLI command or disable the timeout to avoid using WP-Cron.

I found a bug, or have a suggestion, can I contribute back?

Yes! WP Engine has a public GitHub repo where you can contribute back to this plugin. Please open an issue on the Plugin GitHub. We actively develop this plugin, and are always happy to receive pull requests.

The plugin was created by WP Engine to help the WordPress community increase adoption of modern PHP versions. We welcome contributors to this plugin, and are excited to see how developers and other WordPress hosts use this plugin.

To disclose security issues for this plugin please email WordPress@wpengine.com

Well... running the scan on a very outdated site running wp-v.4.9.9, the scan just runs endlessly, never accomplishing anything. Bummer! Should remove the plugin if it doesn't work. Looks to me like most reviews (not spams from friends) is negative.

Useful, defenitely faster than looking throughout all the documentation for every plugin you have installed. Out of 41 plugins, the "unknown" flag only showed for 5 of them (Elementor, Toolbar Extras, Yoast, Livemesh Addons for Elementor and Data Tables Generator by Supsystic), so overall I'd say it works well.

It's not a very clear cut plugin. But in the end it did help me to find the 'bad egg' and get my sites PHP 7.2 ready. Still it does some false red flags. It should be coded in a way that very common plugins should be simply excluded from the scan (example: cloudflare).
I probably use it again though. I would rename all plugin folders and bring them back online one by one and see where the site crashes.