Laravel 4 调试不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18787342/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel 4 debugging not working
提问by suncoastkid
It's extremely frustrating that I have 'debug' => true in the app config but all Laravel is showing is "Whoops, looks like something went wrong." For the love of coding, does somebody know how to get debugging to work?
非常令人沮丧的是,我在应用程序配置中设置了 'debug' => true,但 Laravel 显示的所有内容都是“哎呀,好像出了点问题。” 对于编码的热爱,有人知道如何让调试工作吗?
回答by BlackHyman
I have faced the same problem. Laravel was showing only "Whoops, looks like something went wrong." but this line and not showing the actual error. Then I have checked the app/config/app.php file and changed "debug" => false
to "debug" => true
and it worked perfectly.
我遇到了同样的问题。Laravel 只显示“哎呀,好像出了点问题。” 但这行并没有显示实际错误。然后我检查了 app/config/app.php 文件并更改"debug" => false
为"debug" => true
它,它运行良好。
You said that you have also done it and still not working. I suggest you to run a composer update
command for your project and then try again.
你说你也做了,还是不行。我建议你composer update
为你的项目运行一个命令,然后再试一次。
回答by Sidhannowe
To be sure your app is in development mode, edit bootstrap/start.php
, in the detectEnvironment
function simply put your machine name. On linux use hostname
terminal commande to determine your machine name.
为确保您的应用程序处于开发模式,编辑bootstrap/start.php
,在detectEnvironment
函数中只需输入您的机器名称。在 linux 上,使用hostname
终端命令来确定您的机器名称。
$env = $app->detectEnvironment(array(
'local' => array('homestead', 'Jeanphi'),
));
回答by Antonio Frignani
Actually debugging is working fine for me with L4.0.7 when i set 'debug' => true
in app/config/app.php
That switch tells Laravel to turn on Whoops and to bypass the 'compiled.php' file. When it is disabled, Whoops will not show. A normal server error page is served instead.
实际上,当我'debug' => true
在 app/config/app.php 中设置时,使用 L4.0.7 调试对我来说很好。该开关告诉 Laravel 打开 Whoops 并绕过“compiled.php”文件。当它被禁用时,Whoops 将不会显示。而是提供正常的服务器错误页面。
Were you expecting something else?
你期待别的吗?
EDIT: maybe you are referring to "debugging" as the old profiler bar that were in L3 (Anbu). In that case I suggest you install this package
编辑:也许您将“调试”称为 L3 (Anbu) 中的旧分析器栏。在这种情况下,我建议你安装这个包
回答by Kamal Behboudi
well you need to clear configuration cache and regenerate it each time you change config files
那么你需要清除配置缓存并在每次更改配置文件时重新生成它
run 'php artisan config:cache' in console and your good to go
在控制台中运行 'php artisan config:cache' 就可以了
回答by Andrew Downes
Check you haven't renamed your app/config folder as fideloper suggests in the comment.
检查您是否没有像 fideloper 在评论中建议的那样重命名您的 app/config 文件夹。
For example you might have renamed it to prevent overwriting the default config settings when copying your site somewhere else.
例如,您可能已将其重命名以防止在将站点复制到其他位置时覆盖默认配置设置。
回答by coderama
For all it's worth, I was getting this error now after deployment because I didn't create these folders:
尽管如此,部署后我现在收到此错误,因为我没有创建这些文件夹:
/app/storage/cache
/app/storage/logs
/app/storage/meta
/app/storage/sessions
/app/storage/views
回答by Colin Hilbert
Some changes need an apache restart to take effect.
某些更改需要重新启动 apache 才能生效。
回答by yellow-saint
I came across problem recently, after separating out debug
and a few other config options into a separate (dev.php) config file.
我最近遇到了问题,在将debug
其他一些配置选项分离到一个单独的 (dev.php) 配置文件后。
The in-hindsight obvious, by-logic obscure solution: Don't move debug
out of config/app.php
事后显而易见,逻辑模糊的解决方案:不要debug
移出 config/app.php
回答by T0plomj3r
Had that same problem altought my app was in debug mode. In my case I was deploying on server,and to make that work you must take care of detectEnvironmentvariable.
有同样的问题,但我的应用程序处于调试模式。在我的情况下,我是在服务器上部署的,为了使这项工作正常工作,您必须注意detectEnvironment变量。
It is located in bootstrap/start.php
它位于bootstrap/start.php
$env = $app->detectEnvironment(array(
'local' => array('your_server_name'),
));
as it's instructed in the docs :
正如文档中所指示的那样:
回答by Andres Felipe
I had the same problem several times and I have two possibilities.
我多次遇到同样的问题,我有两种可能性。
- the folder storage doesn't have the right permissions, you should use chmod 755 or chmod 777
- the public/index.php has none permission or a 777
- 文件夹存储没有正确的权限,您应该使用 chmod 755 或 chmod 777
- public/index.php 没有权限或 777
These two options has occurred to me before, maybe there are some more.
这两个选项我以前也遇到过,也许还有更多。