【问题标题】:Errors not displayed in Zend FrameworkZend Framework 中未显示的错误
【发布时间】:2012-12-09 18:13:33
【问题描述】:

我的设置:

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

Zend Framework 1.11.1
PHP 5.3.4
php.ini:
   error_reporting E_ALL | E_STRICT
    display_errors On
    display_startup_errors On

我还启用了对文件的错误记录(文件为空),
并打开xdebug.scream

但在某些情况下不显示错误,我得到的是空白页面(例如,在某些类中解析错误(缺少分号)或使用不存在的接口)。

看起来我遇到了与这个旧问题非常相似的问题:http://framework.zend.com/issues/browse/ZF-2463

在这种情况下调试器不会启动,很难猜测错误实际发生在哪里。
设置自定义错误处理程序也无济于事,并且更改自动加载器的设置以抑制未找到的战争。

任何其他选项如何强制 ZF 始终显示错误消息?

编辑:

application.ini 设置也设置正确

【问题讨论】:

    标签: php zend-framework apache2


    【解决方案1】:

    application.ini中也有

    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    resources.frontController.params.displayExceptions = 1
    

    这些将覆盖您在 php.ini 或 index.php 中设置的任何内容。

    【讨论】:

      【解决方案2】:

      你应该添加:

      define('APPLICATION_ENV', 'development');
      

      在 index.php 中,相反的是:

      define('APPLICATION_ENV', 'production');
      

      然后在 application.ini 中:

      [production : bootstrap]
      
      phpSettings.display_startup_errors = 0
      phpSettings.display_errors         = 0
      settings.debug.enabled             = false
      
      [qa : production]
      
      phpSettings.display_startup_errors = 0
      phpSettings.display_errors         = 0
      settings.debug.enabled             = false
      
      [preqa : qa]
      
      phpSettings.display_startup_errors = 0
      phpSettings.display_errors         = 0
      settings.debug.enabled             = false
      
      [testing : preqa]
      
      phpSettings.display_startup_errors = 1
      phpSettings.display_errors         = 1
      settings.debug.enabled             = false
      
      [development : testing]
      
      phpSettings.display_startup_errors = 1
      phpSettings.display_errors         = 1
      settings.debug.enabled             = true
      

      或类似的东西。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-07-23
        • 1970-01-01
        • 2012-10-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多