PHP错误:无显示和没有日志 [英] PHP errors : No display & No log

查看:47
本文介绍了PHP错误:无显示和没有日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我检查了与 phpinfo()一起使用的 php.ini ,所以我正在编辑正确的php配置文件.

在那个 php.ini 文件中(以及在 phpinfo()详细信息中),我在 On 处有 display_errors error_reporting E_ALL 处.

但是,当我遇到PHP错误时,大多数时候我发现没有日志(在 error_log 指定的文件中,或者在apache vhost中指定的文件中,也不在/var/syslog 中),仅显示空白页面.我还尝试使用 ini_set("display_errors",1),但这并没有改变任何内容.

一件事情很奇怪,我在/var/log 中没有 php5 文件夹(我创建了它,并配置了 error_log 来使用它).

任何想法都将不胜感激,如果不了解有关错误的信息,那么编写代码就不是那么好了!

P.S.我正在使用PHP 5.4&Debian Wheezy上的Symfony2(使用 app_dev.php 文件).

由于@martinezjc,错误日志现在可以工作了,但是在Apache中仍然有空白页.

解决方案

您可以创建自定义目录,记住要分配apache权限

  mkdir/var/log/php-5-4chown www-data/var/log/php-5-4 

php.ini文件中的

  error_log =/var/log/php-5-4/php_errors.log 

此链接讨论了有关日志的更多信息,您可以检查它 http://doc.exyks.org/wiki/Server_php_log_configuration

I checked which php.ini is used with phpinfo(), so I'm editing the right php config file.

In that php.ini file (and in phpinfo() details) I have display_errors at On and error_reporting at E_ALL.

BUT when I have a PHP error, most of the time I find no log (in the file specified by error_log, nor in the file specified in apache vhost, nor in /var/syslog), and only a blank page displayed. I also tried to use the ini_set("display_errors", 1) but that didn't change anything.

One thing was weird, I had no php5 folder in /var/log (I created it, and configured error_log to use it).

Any idea would be much appreciated, that's not so great to code without knowing anything about the errors you have !

P.S. I'm using PHP 5.4 & Symfony2 (using the app_dev.php file), on Debian Wheezy.

Edit : Error logs now work thanks to @martinezjc , but still having a blank page in Apache.

解决方案

You can create a custom directory, remember to assign apache permission

mkdir /var/log/php-5-4
chown www-data /var/log/php-5-4

The in the php.ini file

error_log = /var/log/php-5-4/php_errors.log

This link talk about more about logs, you can check it http://doc.exyks.org/wiki/Server_php_log_configuration

这篇关于PHP错误:无显示和没有日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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