We needed to catch PHP Fatal Errors in the production environment and notify about it to developers, also at the same time, showing our beautiful fail whale page to user instead of ugly error or a white screen of death.
Here I will show you how to do this in CodeIgniter, though credit for this idea goes to hipertracker.
First of all you will need to setup a hook, so update your hooks.php file with following code
$hook['pre_system'] = array( 'class' => 'PHPFatalError', 'function' => 'setHandler', 'filename' => 'PHPFatalError.php', 'filepath' => 'hooks' );
Now put the code shown below in PHPFatalError.php file in your applications hooks folder.
This is the simplifed version of what I have done, so please update handleShutdown function as per your needs.