1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00
This commit is contained in:
Daniel Neto 2025-04-13 17:08:21 -03:00
parent 901c084e1a
commit 3911a2689e

View file

@ -275,9 +275,12 @@ function _mysql_is_open()
return false;
}
// Use ping() to check if the connection is alive
if (!$global['mysqli']->ping()) {
error_log("MySQL connection ping failed; connection appears to be closed. Error: " . $global['mysqli']->error);
$result = $global['mysqli']->query("SELECT 1");
if ($result) {
$result->free();
return true;
} else {
error_log("MySQL connection test query failed. Connection appears to be closed. Error: " . $global['mysqli']->error);
return false;
}
} catch (Exception $exc) {