Created
June 16, 2016 19:49
-
-
Save jlamim/fff150bee32d19c66ecd2d626aa5e614 to your computer and use it in GitHub Desktop.
index.php - Controle de erros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
*--------------------------------------------------------------- | |
* ERROR REPORTING | |
*--------------------------------------------------------------- | |
* | |
* Different environments will require different levels of error reporting. | |
* By default development will show errors but testing and live will hide them. | |
*/ | |
switch (ENVIRONMENT) | |
{ | |
case 'development': | |
error_reporting(-1); | |
ini_set('display_errors', 1); | |
break; | |
case 'testing': | |
case 'production': | |
ini_set('display_errors', 0); | |
if (version_compare(PHP_VERSION, '5.3', '>=')) | |
{ | |
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); | |
} | |
else | |
{ | |
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); | |
} | |
break; | |
default: | |
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); | |
echo 'The application environment is not set correctly.'; | |
exit(1); // EXIT_ERROR | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment