The version of PHP on your new server may not be the same as what you're migrating from. In an ideal world, all servers will be running the most current, most secure version of PHP, and all installed software would be compatible. We don't live in an ideal world, however. There are two directions PHP incompatibilities can go. Newer PHP that isn't supported in an older environment, or older PHP in a more modern environment.
Don't use older versions of PHP
If you're migrating your site to an older version of PHP, I have only one piece of advice, don't. So we'll only address the detection of problems with older versions of software in newer PHP installations. We will look for problems and talk about the types of solutions.
A good first step in checking for compatibility problems is to use a plugin called PHP Compatibility Checker, created by hosting company WP Engine.
PHP Compatibility Checker
This plugin will scan the code on your site, without running it, to look for code that isn't compatible with the version of PHP you chose to test against. To check, you have to do;
- Set the PHP version to test
- Scan the row code
- Report potential issues
PHP Compatibility Issue Types
There are a few different issues that can come from these tests:
- Fatal errors
- False positives
Notice: A notice is inconvenient, but your website still operates normally.
Warnings: Warnings are more serious, they're not definitely problems, but a warning might result in changes to the outcome of code which could cause you problems.
Fatal errors: Fatal errors like parsing errors or syntax errors mean your site will not run with this code and it will need to change.
False positives: A false positive may not be a real problem. Testing code without running it has some limitations. PHP compatibility checking has an important caveat, tests can't distinguish whether code is present for backward compatibility. Code that makes a PHP 7.3 compatible plugin functional on PHP 5.6. This can trigger an error in your tools but be fine when it's running. What if PHP Compatibility Checker skips a plugin? It may skip larger plugins. If so, you can run any WordPress.org hosted plugin through a service called plugintests.com.
This will run a set of tests on the plugin and report back to you. If you see a couple of notices or warnings in your tool, that may not be a major problem. Large numbers of notices and warnings, however, suggest a shoddily written plugin, and even if it does run you may not want to keep it. The discovery that a key element of your site exhibits a fatal error on your new site can be frustrating.
Keep Software Current
If your version of a plugin is out of date, then you should look at updating it. If the software was custom, you may need to replace it or get it repaired.
Older PHP and older software?
In the end, you only have two real options, fix the software or downgrade your new PHP version. Downgrading PHP is probably faster and cheaper but it opens you up to security risks and a slower website. It's only a temporary fix.
Fixing the software starts with reporting the problem to the developer. Responsible developers are probably either already working on a fix or eager to know about problems. If not, you're better off finding a different solution.