升级主机PHP版本前如何确定你的wordpress网站兼容要升级的PHP版本?

原文:https://wpbuffs.com/wordpress-php-version-check/

If you notice that your WordPress hosting provider is not running PHP 7, but has it available to its users, you may want to consider making a WordPress PHP version change so you can benefit from all of PHP 7’s features. However, in order to avoid breaking your site, you should make sure all of your site’s themes and plugins are compatible.

To check for WordPress PHP version compatibility, you can use another simple plugin called PHP Compatibility Checker.

An Overview of PHP Compatibility Checker

The popular hosting company WP Engine created PHP Compatibility Checker in an effort to help the WordPress community adapt to major PHP shifts. Designed to work on all WordPress websites, regardless of which hosting provider is being used, PHP Compatibility Checker checks your website’s theme and plugin code and presents any compatibility issues to you.

Any issues the plugin detects are categorized into errors and warnings. The list of WordPress PHP version errors and warnings will include the file and code line number that is causing issues so you know exactly where the problem is.

In addition, you will notice suggestions for why the code is incompatible with the current PHP version, as well as which themes and plugins may benefit from an upgrade in order to become compatible with higher PHP versions.



Using the PHP Compatibility Checker Plugin

Just like Display PHP Version, navigate to Plugins Add New and search for PHP Compatibility Checker. 

From there, simply click on Install Now and then Activate. You will then notice a new menu item in your WordPress dashboard labeled PHP Compatibility under the Tools section. Click on that to configure the plugin to scan your website for compatibility issues.

Once you click on PHP Compatibility, you will have the option to scan your website for compatibility with the PHP versions 5.3, 5.4, 5.5, 5.6, and 7.0. You also have the option to scan all themes and plugins installed on your website, or restrict your scan to only those themes and plugins that are active on your site.

In this case, I will scan my website for compatibility issues with PHP 7, and will narrow the scan to active theme and plugins.

After clicking on Scan site, the plugin presents me with scan results:

Luckily for me, my active theme, and all active plugins are compatible with PHP 7. This means that I can make the switch from PHP 5.5.38 to PHP 7 with no problems. And the truth is, so long as you use high quality themes and plugins, and keep everything up-to-date, this should be the case for most WordPress users.

False Positives

WP Engine does want to make sure that you know that their plugin is not foolproof. In fact, they provide a list of plugins that are likely to provide false positives (meaning these plugins may come up as having WordPress PHP compatibility issues, when in fact there are no actual issues):

If you find the PHP Compatibility Checker reporting issues related to any of the above-mentioned plugins, check out the details and see if the error or warning is a result of an issue with the compatibility plugin, rather than the plugin being scanned.


你可能感兴趣的:(Wordpress,PHP,Compatibility,Ch,wordpress,php,版本,wordpress,php,plugins)