dougudu3564 2014-11-17 19:25
浏览 73

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

I am getting the blank screen. No errors in the Apache logs, nothing. I was thinking there may be a php syntax error and it quietly dies, but I have configured php.ini to display errors:

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

here are relevant php configurations loaded:

   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

Why is there no Apache error logs? How to trace Apache execution? any help is much appreciated. Thank you

Update: I was wrong, Apache writes log only once on restart at the time of restart at the location specified by ErrorLog in the Apache Configuration, but nothing is written afterwards even when I get the blank site. Here logs from 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'

How to make Apache log for PHP errors or anything for that matter to be able troubleshoot issues?

  • 写回答

1条回答 默认 最新

  • duan2428 2014-11-19 02:03
    关注

    It turns out this was neither Apache nor PHP error, but an application level issue where there is ErrorHandler function declared that does hide all the php errors as described here: PHP's white screen of death

    I came to conclusion to the fact that it is neither Apache nor PHP configurations by changing ErrorLevel to trace8 in virtual host settings:

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

    Afterwards, I tail the logs specified in ErrorLog from command line and make requests. The logs showed:

    [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
    ...
    

    Here, the logs shows 200 response with Content-Length:0. The 200 is good response from Apache, so its not Apache error responsible for the blank page. Seeing the Content-Lenght set to 0, made me think there is something more than PHP setup/configuration issue. It was the ErrorHandler at the Application level.

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100