PHP的白屏死亡 [英] PHP's white screen of death

查看:467
本文介绍了PHP的白屏死亡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我开始回到PHP了,我开始记得我为什么放弃了它。目前我盘子上最烦人的事情就是我所说的PHP的白屏死亡。当PHP由于语法或其他任何内容而导致致命错误时,似乎总是会死,而不会向浏览器发送任何内容。我已将以下内容添加到我的 .htaccess 中,似乎大部分时间都可以工作,但在这些情况下它不起作用。

  php_value display_errors 1 
php_value display_startup_errors 1
php_value error_reporting 2147483647#E_ALL

我错过了什么?目前,我觉得我需要刷新每隔几行代码,以免我写错,不得不搜索许多页面,试图追踪我所犯的一个错误。



编辑:例如,给出以下两行代码:

  $ foo = array(':language'=> $ languageId; 
$ foo = array(':language'=> $ languageId);
/ pre>

第一个将展示白屏的死亡(即,完全没有打印到浏览器),而第二个将执行愉快。

解决方案

错误和警告通常出现在 .... \logs\php_error.log .... \logs\apache_error.log 取决于您的php.ini设置。



还有一些有用的错误通常指向浏览器,但是由于它们不是有效的html,它们不会显示。



所以tail -f 你的日志文件和n你得到一个空白屏幕使用IE查看 - >源菜单选项来查看原始输出。


Now that I'm starting to get back into PHP, I'm starting to remember why I gave it up in the first place. The most annoying thing on my plate at the moment is what I've come to term "PHP's white screen of death". When PHP gets a fatal error due to syntax or whatever, it seems like it will always die without actually sending anything to the browser. I've added the following to my .htaccess, and it seems to work most of the time, but it doesn't work in these cases.

php_value display_errors 1
php_value display_startup_errors 1
php_value error_reporting 2147483647 # E_ALL

Am I missing something? At the moment I feel like I need to hit refresh every few lines of code I write, lest I make a mistake and have to search through many pages trying to track down that one little mistake I made...

EDIT: For example, given the two lines of code below:

$foo = array(':language' => $languageId;
$foo = array(':language' => $languageId);

The first will exhibit the white screen of death (ie, nothing at all printed to the browser), while the second will execute happily.

解决方案

Errors and warnings usually appear in ....\logs\php_error.log or ....\logs\apache_error.log depending on your php.ini settings.

Also useful errors are often directed to the browser, but as they are not valid html they are not displayed.

So "tail -f" your log files and when you get a blank screen use IEs "view" -> "source" menu options to view the raw output.

这篇关于PHP的白屏死亡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆