获取空白屏幕,日志中没有任何内容.这是 PHP 语法和 Apache 的问题吗?


Getting Blank screen and nothing in logs. Is this Php syntax and Apache issue?

我看到空白屏幕。Apache日志中没有错误,什么都没有。我在想可能存在 php 语法错误并且它悄悄地死了,但我已配置 php.ini 以显示错误:

display_errors=On
html_errors=On
error_reporting=E_ALL | E_STRICT 
display_startup_errors=On

以下是加载的相关 PHP 配置:

   display_errors   On  On
     display_startup_errors On
    enable_dl   Off Off
    enable_post_data_reading    On  On
    error_append_string no value    no value
    error_log   no value    no value
    error_prepend_string    no value    no value
    error_reporting 22527

为什么没有 Apache 错误日志?如何跟踪 Apache 的执行?任何帮助都非常感谢。谢谢

更新:我错了,Apache 在 Apache 配置中 ErrorLog 指定的位置重新启动时只在重新启动时写入日志一次,但即使我得到空白站点,之后也不会写入任何内容。以下是来自错误日志的日志:

[Tue Nov 18 17:08:20.372970 2014] [mpm_prefork:notice] [pid 1601] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations
[Tue Nov 18 17:08:20.376988 2014] [mpm_prefork:info] [pid 1601] AH00164: Server built: Jul 22 2014 14:36:39
[Tue Nov 18 17:08:20.377699 2014] [core:notice] [pid 1601] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 18 17:19:32.301203 2014] [mpm_prefork:notice] [pid 1643] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations
[Tue Nov 18 17:19:32.313839 2014] [mpm_prefork:info] [pid 1643] AH00164: Server built: Jul 22 2014 14:36:39
[Tue Nov 18 17:19:32.314481 2014] [core:notice] [pid 1643] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 18 17:50:22.848631 2014] [core:info] [pid 1643] AH00096: removed PID file /var/run/apache2/apache2.pid (pid=1643)
[Tue Nov 18 17:50:22.848631 2014] [mpm_prefork:notice] [pid 1643] AH00169: caught SIGTERM, shutting down
[Tue Nov 18 17:50:25.288368 2014] [mpm_prefork:notice] [pid 3313] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations
[Tue Nov 18 17:50:25.290696 2014] [mpm_prefork:info] [pid 3313] AH00164: Server built: Jul 22 2014 14:36:39
[Tue Nov 18 17:50:25.291613 2014] [core:notice] [pid 3313] AH00094: Command line: '/usr/sbin/apache2'

如何使Apache记录PHP错误或任何相关内容以便能够解决问题?

事实证明,这既不是Apache也不是PHP错误,而是一个应用程序级问题,其中声明了ErrorHandler函数,该函数确实隐藏了所有php错误,如下所述:PHP的白屏死机

通过在虚拟主机设置中将 ErrorLevel 更改为 trace8,我得出的结论是,它既不是 Apache 也不是 PHP 配置:

 LogLevel trace8
 ErrorLog ${APACHE_LOG_DIR}/dev-virtual/error.log

之后,我从命令行跟踪错误日志中指定的日志并发出请求。日志显示:

[Tue Nov 18 18:16:37.398720 2014] [http:trace3] [pid 4054] http_filters.c(977): [client 10.88.12.0:49378] Response sent with status 200, headers:
...
[Tue Nov 18 18:16:37.399243 2014] [http:trace4] [pid 4054] http_filters.c(806): [client 10.88.12.0:49378]   Content-Length: 0
...

在这里,日志显示 200 个响应,内容长度:0。200 是 Apache 的良好响应,因此它不是导致空白页的 Apache 错误。看到 Content-Lenght 设置为 0,让我觉得不仅仅是 PHP 设置/配置问题。它是应用程序级别的错误处理程序。