PHP的白色屏幕死亡 [英] php white screen of death

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

问题描述

我浏览过其他几个问题,并试图错误报告,包括相关的各种解决方案。

I have browsed several other questions, and tried various solutions related to error reporting, including

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

但我还是坚持了死亡的白色屏幕。这似乎当我用我自己的面向对象的类,在页面上才会发生。然而,面向对象的脚本执行成功,但我无法得到HTML显示。偶尔,我可以得到它捕捉异常,但它是间歇性的。

but I am still stuck with the white screen of death. This seems to happen only on pages when I use my own object oriented classes. However, the OOP scripts execute successfully, but I am unable to get the HTML to show. Occasionally, I can get it to catch an Exception but it is intermittent.

例如,我有这个方法:

public function getSubdomain() {
        $this->data->query('SELECT * FROM users WHERE email=:email');
        $this->data->bind(':email', $this->email);
        $this->data->execute();
        if($this->data->rowCount() == 0)
            throw new Exception('There is no account associated with this e-mail address.');
        $curr = $this->data->single();

        return $curr['subdomain'];
    }

^^将执行就好了,我可以得到它使用从OOP类打印死亡($ CURR ['子']); ,但如果我尝试使用PHP,没有在页面上显示出来。没有错误,因此日志,没有源$ C ​​$ C,绝对没有。

^^ That will execute just fine and I can get it to print from the OOP class using die($curr['subdomain']);, but if I try displaying it on a page using PHP, nothing. No errors, so logs, no source code, absolutely nothing.

我使用的多视图与Apache和我的数据库查询使用自定义PDO类完成。

I am using MultiViews with Apache, and my DB queries are done using a custom PDO class.

我已经运行

# php -l new.php

在服务器上直接和它报告

directly on the server and it reports

No syntax errors detected in new.php

当我在WAMP本地运行完全相同的设置,它的工作原理没有问题,但一旦我迁移到我的CentOS /阿帕奇/ PHP机,全乱套了。 MySQL是一个单独的服务器上,但一直没有问题。

When I run the exact same setup on WAMP locally, it works without a problem, but once I migrated over to my CentOS/Apache/PHP machine, all hell broke loose. MySQL is on a seperate server, but has no problems.

我可以提供更具体的code(从服务器都我自己和conf文件)根据需要,我只是想避免任何武断由于问题的性质。在哪里可以从这里(即错误报告的不同方法等)去有什么建议?

I can provide much more specific code (both my own and conf files from the server) as needed, I just want to avoid anything arbitrary due to the nature of the question. Any suggestions on where to go from here (ie, different methods of error reporting, etc.)?

推荐答案

我也遇到过PHP的死几次白屏。在我的经验中最有用的东西,你能做的就是确保PHP是使用记录在php.ini中的error_log指令文件之一:的 http://us1.php.net/manual/en/errorfunc.configuration.php#ini.error-log

I've also encountered PHP's white screen of death a few times. In my experience one of the most helpful things you can do is ensure PHP is logging to file using the error_log directive in php.ini: http://us1.php.net/manual/en/errorfunc.configuration.php#ini.error-log

如果你仍然没有看到PHP的错误任何有用的信息日志已经定义,或在Apache的错误日志,它可能是一次通过你的code以添加调试输出,以确定在哪个点发生致命错误。要做到这一点,你可以打开一个文件句柄,并定期写它自己,或者只是使用的error_log()函数来输出调试消息。

If you're still not seeing any useful information in the PHP error log you've defined, or in the Apache error log, it might be time to add debug output through your code to identify the point at which the fatal error occurs. To do that you can either open a file handle and write to it yourself periodically, or just use the error_log() function to output debug messages.

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

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