php - Laravel 显示简单的 500 错误(没有 Whoops 或 Ignition)
问题描述
解决了
我的主目录中有一个文件夹.ignition
。删除文件夹解决了这个问题。
更新
在进一步检查日志后,我收到以下错误:
[2020-08-19 16:56:45] local.ERROR: Facade\Ignition\IgnitionServiceProvider::Facade\Ignition\{closure}(): Failed opening required '/Users/username/.ignition' (include_path='.:/usr/local/Cellar/php@7.3/7.3.16/share/php@7.3/pear') {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Facade\\Ignition\\IgnitionServiceProvider::Facade\\Ignition\\{closure}(): Failed opening required '/Users/username/.ignition' (include_path=' .:/usr/local/Cellar/php@7 .3/7.3.16/share/php@7.3/pear') at /Users/username/PhpstormProjects/test/vendor/facade/ignition/src/IgnitionServiceProvider.php:202)
原版
当从控制器 ( throw new Exception('Test Exception');
) 抛出自定义异常时,我得到一个简单的 500 错误,而不是我的 Laravel7.24
应用程序中的 Ignition(或 Whoops)调试页面。我已经APP_DEBUG
设置true
并APP_ENV
设置为local
。
再深入一点,似乎下面的行vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php
正在检查是否Whoops
存在并使用该检查返回 Symfony 错误页面或 Whoops 错误页面。
return config('app.debug') && class_exists(Whoops::class)
? $this->renderExceptionWithWhoops($e)
: $this->renderExceptionWithSymfony($e, config('app.debug'));
如果我运行dd(class_exists(Whoops::class))
我会得到true
尽管它不在我的composer.json
文件中。奇怪的是,它看起来像是Ignition
作为filp/whoops
其依赖项之一而引入的,这始终是正确的。Ignition
已安装(根据composer.json
下面的文件),但未显示错误页面。如果不是来自vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php
文件,Ignition 包如何呈现其页面?
总而言之,日志显示我的异常被抛出,但500
浏览器中显示了一个没有上下文的简单错误。
有什么建议我下一步可以看吗?
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.4.9",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"intervention/image": "^2.5",
"laravel/cashier": "^11.2",
"laravel/framework": "^7.24",
"laravel/passport": "^8.4",
"laravel/telescope": "^3.2",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.0",
"laravelcollective/html": "^6.1",
"league/flysystem-aws-s3-v3": "^1.0",
"spatie/laravel-permission": "^3.11",
"spatie/laravel-query-builder": "^2.8"
},
"require-dev": {
"facade/ignition": "^2.0",
"barryvdh/laravel-ide-helper": "^2.6",
"beyondcode/laravel-dump-server": "^1.4",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"files": [
"app/Http/Support/Helpers/action_response_helpers.php"
],
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"@php artisan ide-helper:generate",
"@php artisan ide-helper:meta"
]
}
}
解决方案
推荐阅读
- r - 如何根据某些条件更改列的值?
- jbpm - 如何在 jBPM 中以编程方式设置任务表单数据?
- c++ - 使用 memory_order_seq_cst 输出 10
- android - Android中的View Outline Provider在阴影上方绘制一个白色矩形
- algorithm - 在任何给定的问题中,是否有任何定义的方式来选择用于记忆的变量?
- javascript - 写递归函数,用输入转换数据是一个数组
- node.js - npm i -g @vue/cli @vue/cli-service-global` npm ERR!退出状态 134
- html - 项目元素的菜单下拉顶部和底部填充问题
- go - 查找阻塞的 goroutine 的最佳方法是什么?(即在频道上等待消息时卡住了)
- python - 合并重叠的日期时间间隔