diff --git a/config/bootstrap.php b/config/bootstrap.php index 82a92c60f..e05ec9fe2 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -85,7 +85,14 @@ Configure::config('default', new PhpConfig()); Configure::load('app', 'default', false); } catch (Exception $e) { - exit($e->getMessage() . "\n"); + // The error and exception traps need app.php, so report the failure by hand. + if (PHP_SAPI === 'cli') { + fwrite(STDERR, $e->getMessage() . "\n"); + } else { + error_log($e->getMessage()); + http_response_code(500); + } + exit(1); } /*