mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-15 17:05:55 +00:00
pdo_connect: catch exception on create
This commit is contained in:
@@ -54,12 +54,12 @@ class Db
|
|||||||
$db_port = defined('DB_PORT') && DB_PORT ? ';port=' . DB_PORT : '';
|
$db_port = defined('DB_PORT') && DB_PORT ? ';port=' . DB_PORT : '';
|
||||||
$db_host = defined('DB_HOST') && DB_HOST ? ';host=' . DB_HOST : '';
|
$db_host = defined('DB_HOST') && DB_HOST ? ';host=' . DB_HOST : '';
|
||||||
|
|
||||||
$this->pdo = new PDO(DB_TYPE . ':dbname=' . DB_NAME . $db_host . $db_port,
|
try {
|
||||||
DB_USER,
|
$this->pdo = new PDO(DB_TYPE . ':dbname=' . DB_NAME . $db_host . $db_port,
|
||||||
DB_PASS);
|
DB_USER,
|
||||||
|
DB_PASS);
|
||||||
if (!$this->pdo) {
|
} catch (Exception $e) {
|
||||||
print("Error connecting via PDO.");
|
print "<pre>Exception while creating PDO object:" . $e->getMessage() . "</pre>";
|
||||||
exit(101);
|
exit(101);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user