This is how I checked the compatibility of my WordPress theme and plugin (code) with PHP Compatibility Checker
I have a number of guides on moving away from CPanel, Setting up VM’s on AWS, Vultr or Digital Ocean along with installing and managing WordPress from the command line. PHP is my programming language of choice.
Now on with the post
Snip from: https://wordpress.org/plugins/php-compatibility-checker/
What is PHP Compatibility Checker
> 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.
Install PHP Compatibility Checker
I instaled by SSH’ing to my server and opening my WP Plugins folder
I grabbed the latest download URL from here (hover over the download button), at the time of writing this was the latest version: https://downloads.wordpress.org/plugin/php-compatibility-checker.1.4.6.zip
I downloaded the plugin on my server (then unzipped it and deleted the zip)
wget https://downloads.wordpress.org/plugin/php-compatibility-checker.1.4.6.zip unzip php-compatibility-checker.1.4.6.zip rm php-compatibility-checker.1.4.6.zip
Enable PHP Compatibility Checker Plugin
I enabled the plugin
I clicked on the following message
> You have just activated the PHP Compatibility Checker. Start scanning your plugins and themes for compatibility with the latest PHP versions now!
I already have PHP 7.2 installed so let’s scan my site. PHP 7.3 will be available in December and it is already being tested in beta.
PHP Compatibility Checker site scanning is very business like
PHP Compatability Checker Scan Results
2 of 22 plugins I use were not PHP 7.2 compatible (WordFence and WP Meta SEO)?
I read on twitter that Wordfence may be a false positive.
Clicking toggle details reveal why the scan failed. A Two Factor Auth plugin was all OK.
Your results will hopefully be…
> PHP 7.2 compatible
Of if errors exist it should explain why it did not pass.
> FOUND 1 ERROR AFFECTING 1 LINE
> 251 | ERROR | The function is_countable() is not present in PHP version 7.2 or earlier
I can’t wait for PHP 7.3 scanning. I will update this post in December 2018 after PHP 7.3 is released.
Good luck and I hope this guide helps someone
Ask a question or recommend an article
v1.0 Initial post