In theory, when you know something might break, you should go with a try / catch construct like this and add a simple mail () command [but setting up mail () is another big topic, but skip this in detail] .
try { // your actions that may fail } catch (Exception $e) { // the catch block happens only when your above stuff fails // when exactly things fail can be read here // http://php.net/manual/en/language.exceptions.php // getMessage() really get the human-readable error content $message = $e->getMessage(); mail(' caffeinated@example.com ', 'My Subject', $message); }
source share