Validate PHP version mismatch (#11621)

* Validate PHP version mismatch on the web interface

* fixes
This commit is contained in:
Tony Murray
2020-05-15 23:44:18 -05:00
committed by GitHub
parent 4edff1e88a
commit 216f16f159
+6
View File
@@ -56,6 +56,12 @@ class Php extends BaseValidation
if (Config::get('update') && version_compare(PHP_VERSION, self::PHP_MIN_VERSION, '<')) {
$validator->warn("PHP version " . self::PHP_MIN_VERSION . " is the minimum supported version as of " . self::PHP_MIN_VERSION_DATE . ". We recommend you update PHP to a supported version (" . self::PHP_RECOMMENDED_VERSION . " suggested) to continue to receive updates. If you do not update PHP, LibreNMS will continue to function but stop receiving bug fixes and updates.");
}
$web_version = PHP_VERSION;
$cli_version = rtrim(shell_exec('php -r "echo PHP_VERSION;"'));
if (version_compare($web_version, $cli_version, '!=')) {
$validator->fail("PHP version of your webserver ($web_version) does not match the cli version ($cli_version)", "If you updated PHP recently, restart php-fpm or apache to switch to the new version");
}
}
private function checkSessionDirWritable(Validator $validator)