PHP error_log not respecting the timezone setting?
Timezone problem in error_log?
If I explicitly set the error_log directive to a file in php, and then use the error_log statement with a timezone, then why does it not respect my timezone? See below:
[soham@soham.dev ~]$ cat errlog.php
<?php
date_default_timezone_set('America/Los_Angeles开发者_JAVA技巧');
ini_set('error_log', '/tmp/blah');
ini_set('display_errors', 'on');
error_log('whatever');
?>
[soham@soham.dev ~]$ php errlog.php
[soham@soham.dev ~]$ cat /tmp/blah
[12-Aug-2010 02:16:29] whatever
[soham@soham.dev ~]$ date
Wed Aug 11 19:16:34 PDT 2010
[soham@soham.dev ~]$
The closest thing I can find is http://bugs.php.net/45191, but that is fixed in 5.2.10. But I'm running 5.2.11:
[soham@soham.dev ~]$ 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
[soham@soham.dev ~]$
Relevant INI settings (which are being over-riden in the code):
[soham@soham.dev ~]$ php -i | grep date.timezone
date.timezone => America/Los_Angeles => America/Los_Angeles
[soham@soham.dev ~]$ php -i | grep error_log
error_log => no value => no value
What am I missing? Any clues appreciated. Thanks.
Upgrading to php5.3.3 fixed this. Have not tried versions in-between (i.e. between 5.2.11 and 5.3.3).
精彩评论