PHP的error_log不尊重时区设置?
问题描述:
error_log中的时区问题?PHP的error_log不尊重时区设置?
如果我明确地将error_log指令设置为php中的文件,然后将error_log语句与时区一起使用,那么它为什么不尊重我的时区?请看下图:
[[email protected] ~]$ cat errlog.php
<?php
date_default_timezone_set('America/Los_Angeles');
ini_set('error_log', '/tmp/blah');
ini_set('display_errors', 'on');
error_log('whatever');
?>
[[email protected] ~]$ php errlog.php
[[email protected] ~]$ cat /tmp/blah
[12-Aug-2010 02:16:29] whatever
[[email protected] ~]$ date
Wed Aug 11 19:16:34 PDT 2010
[[email protected] ~]$
我能找到最接近的是http://bugs.php.net/45191,而是固定在5.2.10。但我运行5.2.11:
[[email protected] ~]$ php -v
PHP 5.2.11 (cli) (built: Apr 17 2010 16:25:19)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
[[email protected] ~]$
相关INI设置(这是被过度riden代码):
[[email protected] ~]$ php -i | grep date.timezone
date.timezone => America/Los_Angeles => America/Los_Angeles
[[email protected] ~]$ php -i | grep error_log
error_log => no value => no value
我缺少什么?任何线索表示赞赏。谢谢。
答
升级到php5.3.3修复了这个问题。没有试过版本之间(即5.2.11和5.3.3之间)。
我在PHP 5.4.7中使用XAMPP并遇到此问题。不知道从哪里开始提到。 – 2013-03-05 03:58:07