【问题标题】:Not getting PHP errors?没有收到 PHP 错误?
【发布时间】:2013-06-20 22:19:10
【问题描述】:

由于某种原因,在这个特定的脚本上,它是我在很多其他地方使用的脚本的副本,我没有收到任何 PHP 错误。它只是显示一个空白页面,今天早上我花了很长时间才找到丢失的分号。为什么不显示错误?

我的这个子域的 PHP.INI:

display_errors = On
short_open_tag = On
memory_limit = 32M
date.timezone = Europe/Paris

页面顶部的代码:

session_start();

error_reporting(E_ALL);
ini_set('display_errors', '1');

子域设置为以Apache Module 运行 PHP,这与我使用的所有其他域相同。

所以我不确定为什么我没有显示错误。谁能告诉我?

编辑: 这已解决,因为我产生的错误在我得到这些行的页面上: 错误报告(E_ALL); ini_set('display_errors', '1'); 书面。当我将错误放在单独的页面上并包含它时,我可以看到错误。

我想这就是他们使用引导程序的原因!

【问题讨论】:

标签: php


【解决方案1】:

您还应该在php.ini 中将error_reporting 设置为E_ALL:当出现解析错误(例如缺少分号)时,您的error_reporting(E_ALL) 将不会被使用。

【讨论】:

    【解决方案2】:

    您可以尝试更改此行以从 php 获取更多信息:

     ; The display of errors which occur during PHP's startup sequence are handled
     ; separately from display_errors. PHP's default behavior is to suppress those
     ; errors from clients. Turning the display of startup errors on can be useful in
     ; debugging configuration problems. But, it's strongly recommended that you
     ; leave this setting off on production servers.
    
     display_startup_errors = On
    
     ; When PHP displays or logs an error, it has the capability of formatting the
     ; error message as HTML for easier reading. This directive controls whether
     ; the error message is formatted as HTML or not.
     ; Note: This directive is hardcoded to Off for the CLI SAPI
    
     html_errors = On
    

    【讨论】:

      【解决方案3】:
      error_reporting(E_ALL);
      ini_set('display_errors',1);
      ini_set('display_startup_errors',1);
      

      【讨论】:

        猜你喜欢
        • 2020-06-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-10-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多