How can I catch and log PHP fatal errors in CodeIgniter?
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
ini_set('display_errors', '1');
break;
case 'testing':
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
}
When environment is set to production and there's a fatal error, I just get a white screen. If the environment is set to development, the error gets displayed in the browser but it doesn't get logged. I have error logging enabled but it only catches PHP notices and warnings.