2014-11-03 111 views
1

无法让Yii向webbrowser显示错误。配置自定义错误处理程序配置Yii没有显示任何错误

'errorHandler' => array(
      // use 'site/error' action to display errors 
      'errorAction' => 'site/error', 
     ), 

但所有的错误只得到写入application.log然后阿帕奇服务器空白页面错误500。如何让Yii在屏幕上打印错误?

的index.php

// remove the following lines when in production mode 
defined('YII_DEBUG') or define('YII_DEBUG', true); 
// specify how many levels of call stack should be shown in each log message 
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); 
+0

您是否将YII_DEBUG设置为true? – 2014-11-03 21:12:46

+0

可能重复[如果在错误之前显示错误输出](http://stackoverflow.com/questions/23843038/if-in-yii-error-show-outputing-before-error) – 2014-11-03 21:20:41

+0

请给我们看看'actionError ()'功能从您的SiteController ** ** error.php ** **文件** protected/views/site ** – 2014-11-04 06:44:55

回答

-1

设置YII_DEBUG到真正在你的index.php,你应该看到的错误的东西上来。不要忘记在生产过程中改变这一点。

(这个问题是会得到如已标记问哈哈)

+0

这没有帮助,不幸的是...... – 2014-11-03 21:21:13

1

这可能是更一个Apache设置。你有什么是正确的。

矿山也有这一个。

defined('YII_DEBUG_SHOW_PROFILER')or define('YII_DEBUG_SHOW_PROFILER',true);

您也可以这样做。

error_reporting(E_ALL); 
ini_set("display_startup_errors","1"); 
ini_set("display_errors","1"); 
3

您应该稍微修改一下config/main.php。有一个项目errorHandler。它应该看起来像这样:

'errorHandler' => [ 
    // use 'site/error' action to display errors 
    'errorAction' => YII_DEBUG ? null : 'site/error', 
], 

发生这种情况是由于CErrorHandler::$errorAction的优先级增加。这里是讨论:https://github.com/yiisoft/yii/issues/3760

相关问题