views:

21

answers:

1

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:

[[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] ~]$

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:

[[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] ~]$

Relevant INI settings (which are being over-riden in the code):

[[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

What am I missing? Any clues appreciated. Thanks.

A: 

Upgrading to php5.3.3 fixed this. Have not tried versions in-between (i.e. between 5.2.11 and 5.3.3).

Soham