php - Laravel:500 服务器错误但没有错误日志?
问题描述
我通过 Laravel 遇到了 500 服务器错误,并且没有错误被写入日志文件。我已经验证权限没问题,并且 Laravel 可以写入日志文件。我不确定我在这里还有什么其他选择。
我已经将错误追到了这个类,注释掉的行是导致错误的行。
class CollectionResource extends JsonResource
{
public function toArray($request)
{
return [
'id' => $this->id,
'name' => $this->name,
// 'member_count' => $this->items()->count(),
// 'member_count_today' => $this->items()->whereDate('collection_entries.created_at', Carbon::today()->toDateString())->count(),
// 'member_images' => $this->items->take(10)->pluck('data.picture'),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}
该错误相当零星,并不总是发生。
解决方案
先运行这个命令
php artisan optimize:clear
应用程序/配置/app.php
'debug' => true, //env('APP_DEBUG'),
检查 .env 文件,确保权限设置正确,如果文件夹不存在,则手动创建 storage/logs 文件夹。
推荐阅读
- reactjs - what is the best way to deploy react app in lan only
- javascript - 我的 JavaScript 代码中缺少什么?
- python - 在 tkinter Text 小部件中获取位置
- node.js - nightmare.js, on .evaluate this gives me an error on node
- javascript - Unexpected token m in JSON at position 0 for cloud 9.io
- amazon-web-services - Allowing IAM access to only a specific subdomain on Route 53
- r - 如何获得相同的替换行和数据?
- kubernetes - kubectl 命令获取在 k8s 主节点上运行的 pod 列表
- javascript - Vue 自定义指令使用更新后的 Dom(或 $el)
- python - HBase 和集成测试