Fix php-cli can't find db-config.php
Global DEBUG switch and db fail handler.