Check PHP version first (#10473)
Check PHP version before anything so we can inform the user instead of them getting generic error 500.
This commit is contained in:
parent
91d88ee6a7
commit
c6e719b9be
|
@ -37,16 +37,16 @@ use Toastr;
|
||||||
|
|
||||||
class Checks
|
class Checks
|
||||||
{
|
{
|
||||||
public static function preBoot()
|
public static function preAutoload()
|
||||||
{
|
{
|
||||||
// check php extensions
|
// Check PHP version otherwise it will just say server error
|
||||||
if ($missing = self::missingPhpExtensions()) {
|
if (version_compare('7.1.3', PHP_VERSION, '>=')) {
|
||||||
self::printMessage(
|
self::printMessage(
|
||||||
"Missing PHP extensions. Please install and enable them on your LibreNMS server.",
|
'PHP version 7.1.3 or newer is required to run LibreNMS',
|
||||||
$missing,
|
null,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,6 +63,18 @@ class Checks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function preBoot()
|
||||||
|
{
|
||||||
|
// check php extensions
|
||||||
|
if ($missing = self::missingPhpExtensions()) {
|
||||||
|
self::printMessage(
|
||||||
|
"Missing PHP extensions. Please install and enable them on your LibreNMS server.",
|
||||||
|
$missing,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post boot Toast messages
|
* Post boot Toast messages
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,10 +14,9 @@ define('LARAVEL_START', microtime(true));
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@require_once __DIR__ . '/../app/Checks.php';
|
||||||
|
\App\Checks::preAutoload();
|
||||||
|
|
||||||
@include __DIR__ . '/../vendor/autoload.php';
|
@include __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
if (!class_exists(\App\Checks::class)) {
|
|
||||||
require __DIR__ . '/../app/Checks.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
\App\Checks::postAutoload();
|
\App\Checks::postAutoload();
|
||||||
|
|
Loading…
Reference in New Issue