Added PHP_SAPI checking for cli scripts in exception handler