简体   繁体   English

如何调试Laravel 5项目?

[英]How to debug Laravel 5 projects?

I ran command 我跑了命令

php artisan optimize

and changed debug settings in app.php file to be 并将app.php文件中的调试设置更改为

'debug' => 'true',

and added 'everyone' to have full access over 'storage' folder. 并添加了“所有人”以对“存储”文件夹具有完全访问权限。 I don't know what else I can do to let debugger work in my Laravel 5 project. 我不知道我还能做些什么来让Laravel 5项目中的调试器工作。 I'm stuck with 'Whoops, looks like something went wrong' message. 我一直停留在“糟糕,好像出了点问题”的消息上。 Any Ideas?? 有任何想法吗??

The debug => true will just show you the full error stack when you hit an error with your app. 当您在应用中遇到错误时, debug => true只会显示完整的错误堆栈。 It doesn't give metrics and statistics. 它不提供指标和统计信息。 If you are looking for that kind of information check out the article here: 如果您正在寻找此类信息,请在此处查看文章:

https://laravel-news.com/2015/02/laravel-debugbar/ https://laravel-news.com/2015/02/laravel-debugbar/

The error you are receiving is a general error, likely server-side configuration. 您收到的错误是一般错误,可能是服务器端配置。 Without any information on your setup it will be pretty hard to determine what your issue is. 如果没有有关您的设置的任何信息,将很难确定您的问题所在。 Based upon your question and comments to others responses I have a couple of things for you. 根据您的问题和对其他意见的评论,我为您准备了两件事。

  1. You stated "I don't know what else I can do to let debugger work in my Laravel 5 project". 您说“我不知道我还能做些什么来让调试器在Laravel 5项目中工作”。 Laravel 5 doesn't have a native debugger any more which I imagine is why your page just shows "Whoops, looks like something went wrong". Laravel 5没有本机调试任何更多我想象就是为什么你的页面只显示“哎呦,看起来像出事了”。 Your statement would indicate that you have a debugger, so which are you trying to use, or was that statement incorrect? 您的陈述将表明您具有调试器,因此您要尝试使用哪个,或者该陈述不正确?

  2. You stated that you changed the debug settings the app.php file. 您说过您更改了app.php文件的调试设置。 Is there a reason why you changed this in app.php? 您是否有理由在app.php中对此进行了更改? The debug setting by default is 'debug' => env('APP_DEBUG') which is sufficient in most cases. 默认情况下,调试设置为'debug' => env('APP_DEBUG') ,在大多数情况下这已足够。 You should have a .env file in the root of your project (created automatically if you did a composer create-project, if not you need to copy .env.example to .env on your own). 您应该在项目的根目录中有一个.env文件(如果您是作曲者create-project,则会自动创建。如果没有,则需要将.env.example复制到.env)。 The .env file will enable debug for you as there is a line that states APP_DEBUG=true. .env文件将为您启用调试,因为有一行指出APP_DEBUG = true。

  3. Jesse Schutt gave great information in his response above (which I recommend upvoting), including a link to a debug bar that is compatible with L5. 杰西·舒特给他的上述反应大量信息(我建议upvoting),包括一个链接到一个调试工具栏是与L5兼容。 Yet again you are stating that you are satisfied with your error stack which implies that you actually have one. 再次说明您对错误堆栈感到满意,这意味着您实际上拥有一个错误堆栈。 If you were satisfied with it, you would have no need to have posted here as you would already have more information on your error. 如果对此感到满意,则无需在此处发布信息,因为您已经拥有有关错误的更多信息。 If you are assuming that the filp/whoops is in l5 still and that's what you want you'll have to re-enable it. 如果您假设filp / whoops仍在l5中,那就是您想要的,则必须重新启用它。 Follow the instructions at http://mattstauffer.co/blog/bringing-whoops-back-to-laravel-5 请按照http://mattstauffer.co/blog/bringing-whoops-back-to-laravel-5上的说明进行操作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM