diff --git a/web/includes/database.php b/web/includes/database.php index 4298b4ce8..8e621e2f9 100644 --- a/web/includes/database.php +++ b/web/includes/database.php @@ -64,7 +64,8 @@ function dbConnect() { $dbConn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $ex) { - echo "Unable to connect to ZM db using dsn $dsn host".ZM_DB_HOST.' user: ('.ZM_DB_USER.') password ('.ZM_DB_PASS.': '.$ex->getMessage(); + global $error_message; + $error_message = "Unable to connect to ZM db using dsn $dsn

".$ex->getMessage(); error_log('Unable to connect to ZM DB ' . $ex->getMessage()); $dbConn = null; } @@ -72,7 +73,8 @@ function dbConnect() { } // end function dbConnect if ( !dbConnect() ) { - ZM\Fatal('Failed db connection'); + include('views/no_database_connection.php'); + exit(); } function dbDisconnect() { diff --git a/web/views/no_database_connection.php b/web/views/no_database_connection.php new file mode 100644 index 000000000..1377d4423 --- /dev/null +++ b/web/views/no_database_connection.php @@ -0,0 +1,63 @@ + + + + + + + + + +
+ +
+

+ +

+

ZoneMinder will retry connection in 30 seconds.

+

+ +

+
+
+ + +