39 lines
2.3 KiB
Text
39 lines
2.3 KiB
Text
Index: LibreNMS/Validations/Php.php
|
|
--- LibreNMS/Validations/Php.php.orig
|
|
+++ LibreNMS/Validations/Php.php
|
|
@@ -56,7 +56,7 @@ class Php extends BaseValidation
|
|
}
|
|
|
|
$web_version = PHP_VERSION;
|
|
- $cli_version = rtrim(shell_exec('php -r "echo PHP_VERSION;"'));
|
|
+ $cli_version = rtrim(shell_exec('${MODPHP_BIN} -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');
|
|
}
|
|
@@ -73,7 +73,7 @@ class Php extends BaseValidation
|
|
foreach ($required_modules as $extension) {
|
|
if (! extension_loaded($extension)) {
|
|
$validator->fail("Missing PHP extension: $extension", "Please install $extension");
|
|
- } elseif (shell_exec("php -r \"var_export(extension_loaded('$extension'));\"") == 'false') {
|
|
+ } elseif (shell_exec("${MODPHP_BIN} -r \"var_export(extension_loaded('$extension'));\"") == 'false') {
|
|
$validator->fail("Missing CLI PHP extension: $extension", "Please install $extension");
|
|
}
|
|
}
|
|
@@ -120,7 +120,7 @@ class Php extends BaseValidation
|
|
$ini_tz = ini_get('date.timezone');
|
|
$sh_tz = rtrim(shell_exec('date +%Z'));
|
|
$php_tz = date('T');
|
|
- $php_cli_tz = rtrim(shell_exec('php -r "echo date(\'T\');"'));
|
|
+ $php_cli_tz = rtrim(shell_exec('${MODPHP_BIN} -r "echo date(\'T\');"'));
|
|
|
|
if (empty($ini_tz)) {
|
|
// make sure timezone is set
|
|
@@ -139,7 +139,7 @@ class Php extends BaseValidation
|
|
// check if web and cli timezones match (this does nothing if validate.php is run on cli)
|
|
// some distros have different php.ini for cli and the web server
|
|
if ($sh_tz !== $php_cli_tz) {
|
|
- $ini_file = rtrim(shell_exec('php -r "echo php_ini_loaded_file();"'));
|
|
+ $ini_file = rtrim(shell_exec('${MODPHP_BIN} -r "echo php_ini_loaded_file();"'));
|
|
$validator->fail(
|
|
"The CLI php.ini ($php_cli_tz) timezone is different than your system's timezone ($sh_tz)",
|
|
"Edit your CLI ini file $ini_file and set the correct timezone ($sh_tz)."
|