Where and how to write a code that will check if error showing "MySQL server has gone away" appears and print some error diferently and more nicely.
Warning: mysqli::mysqli() [mysqli.mysqli]: MySQL server has gone away
Where and how to write a code that will check if error showing "MySQL server has gone away" appears and print some error diferently and more nicely.
Warning: mysqli::mysqli() [mysqli.mysqli]: MySQL server has gone away
There is another post that answers this (Solving "MySQL server has gone away" errors) with the following code snippet:
try {
$conn = getDbConn();
saveData($conn, $val);
} catch (DbException $e) {
if (strstr($e->getMessage(), 'MySQL server has gone away') {
// WRITE OUT NICE LOG HERE AND RETRY IF WANTED
....
// RETRY
$conn = getDbConn();
saveData($conn, $val);
} else {
// we have a problem connecting or something, pass the exception along
throw $e;
}
}