php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47466 Phd seems to ignores .ini timezone
Submitted: 2009-02-20 16:23 UTC Modified: 2011-06-07 15:40 UTC
Votes:19
Avg. Score:4.2 ± 0.8
Reproduced:17 of 17 (100.0%)
Same Version:8 (47.1%)
Same OS:4 (23.5%)
From: kvz@php.net Assigned: philip (profile)
Status: Closed Package: Doc Build problem
PHP Version: Irrelevant OS: Ubuntu Intrepid
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
49 + 14 = ?
Subscribe to this entry?

 
 [2009-02-20 16:23 UTC] kvz@php.net
Description:
------------
It looks like phd is explicity trying to use the system default timezone. 

 kevin@jade:/mnt/aeon# php --ini |egrep 'php\.ini$'
 Loaded Configuration File:         /etc/php5/cli/php.ini


So I've set the timezone in /etc/php5/cli/php.ini to:

 kevin@jade:~/workspace/peardoc$ cat /etc/php5/cli/php.ini |grep timezone
 ; Defines the default timezone used by the date functions
 date.timezone = 'Europe/Amsterdam'

Still phd keeps reporting: Strict Standards: date(): It is not safe to rely on the system's timezone settings.

When I change the head of $(which phd) to:
 #!/usr/bin/php
 <?php
 date_default_timezone_set('Europe/Amsterdam');

The warnings disappear.

When I change the head of $(which phd) to:
 phpinfo(); exit();

It reads:
 Default timezone => Europe/Berlin
 date.timezone => 'Europe/Amsterdam' => 'Europe/Amsterdam'

Reproduce code:
---------------
dpkg-reconfigure tzdata
 Current default timezone: 'Europe/Amsterdam'
 Local time is now:      Fri Feb 20 17:05:33 CET 2009.
 Universal Time is now:  Fri Feb 20 16:05:33 UTC 2009.
date +%Z
 CET


phd -f xhtml -t pearchunkedhtml -o /tmp -d .manual.xml 

Expected result:
----------------
No timezone warnings

Actual result:
--------------
Strict Standards: date(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /usr/share/php/phd/config.php on line 78

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-20 12:45 UTC] bjori@php.net
I can't reproduce this.

Do you maybe have multiple PHP instances installed?
What does 'pear config-get php_bin' return?


 [2009-03-20 12:48 UTC] kvz@php.net
Thanks for testing it.

root@jade:/home/kevin# pear config-get php_bin
/usr/bin/php

Could it be related to my locales?
root@jade:/home/kevin# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME=nl_NL.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
 [2009-04-11 10:28 UTC] bjori@php.net
I have no idea how this could not be working.
Derick, help please :)


 [2009-06-18 21:27 UTC] mtrias at cei dot fing dot edu dot uy
Same problem here :(

Wamp installation in Intel x86
Os: WinXp Pro
PHP: PHP 5.2.9-2 (cli) (built: Apr  9 2009 08:23:19)

And look at this!  php founds value Europe/Madrid in php.ini but shows 
the Strict Standard error.

T:\>php --ri date

date

date/time support => enabled
"Olson" Timezone Database Version => 2009.1
Timezone Database => internal

Strict Standards: Unknown: It is not safe to rely on the system's 
timezone setti
ngs. Please use the date.timezone setting, the TZ environment variable 
or the da
te_default_timezone_set() function. In case you used any of those 
methods and yo
u are still getting this warning, you most likely misspelled the 
timezone identi
fier. We selected 'America/Sao_Paulo' for '-3.0/no DST' instead in 
Unknown on li
ne 0
Default timezone => America/Sao_Paulo

Directive => Local Value => Master Value
date.timezone => 'Europe/Madrid' => 'Europe/Madrid'
date.default_latitude => 31.7667 => 31.7667
date.default_longitude => 35.2333 => 35.2333
date.sunset_zenith => 90.583333 => 90.583333
date.sunrise_zenith => 90.583333 => 90.583333
 [2009-09-01 15:55 UTC] rod dot lopez at archery-it dot com dot au
I got the same issue on Windows SBS 2003, IIS6, FastCGI, PHP 5.3.0.  php.ini has date.timezone = Australia/ACT, but warning still appears.  If I add <?php date_default_timezone_set('Australia/ACT'); at the begining warning goes away.
 [2009-10-24 20:49 UTC] cjm at siegeweb dot co dot uk
Same problem for me (php 5.3.0 - IIS 7). Still get warning after setting 
the timezone in php.ini. Have verified timezone, tried many others, with 
quotes/without quotes. Nothing works, php ignores that line completely.
 [2009-10-24 21:10 UTC] cjm at siegeweb dot co dot uk
Something odd just happened...

I opened php.ini in C:/PHP, deleted all but the line 'date.timezone = 
Europe/London' saved, restarted IIS. It didn't work. still got the 
warning.

Then I went to that start menu > All Programs > Php. Expanded it and 
saw php.ini. Clicked to edit it and got a completely different version 
of php.ini (with timezone commented out). Weird (as i thought i'd just 
changed that). I verified that the location of the file was 
C:/PHP/php.ini - it was. I browsed to C:/PHP/php.ini - opened that 
only to see my new version with only the line 'date.timezone = 
Europe/London'!? 2 files seemingly at the same location? Saving the 
version from the start menu didn't work. So I copied the content of 
the full .ini file over to the single line version, changed the 
timezone, saved it restarted IIS and timezone warnings have 
dissapeared.
 [2010-05-27 09:41 UTC] pjardine at team dot telstra dot com
Same issue. Win server 2003, IIS 6, PHP 5.3.2
Was having problems - PHP info page reported default timezone set ("Australia/Melbourne") but the error was still being logged and the php_info page reported "no value" in the configured timezone. Opened the php.ini file in a text editor and saved it as a differnt name. I then opened a command prompt window and copied the newly save file file to overwrite the original file. Problem resolved (no more errors, php_info correctly reporting configured timezone). Not sure why. I did notice something odd when I initially copied php.ini-production using windows explorer (I used ^C, ^V to create the copy, then renamed the "Copy of ..." to "php.ini". I ended up with 2 files of the same name, one of which had a (2) after it. I renamed the files again using windows explorer (using the date stamp to decide which was which)). Maybe some odd windows behaviour caused this?
 [2011-05-19 17:57 UTC] demian dot katz at villanova dot edu
I am seeing the same behavior with PHP 5.3.6 built from source on a RedHat box.  I have set an explicit date.timezone value in php.ini, and I do not see the warning when accessing web pages through Apache.  However, when using the CLI tool, I always see the warning.  Running phpinfo() from the command line confirms that PHP is using the same .ini file whether accessed via CLI or web and that the date.timezone value IS being read but is apparently being ignored.

Is there some environment variable that overrides the date.timezone value?  If so, this seems like undesirable behavior.
 [2011-05-19 18:30 UTC] philip@php.net
-Status: Assigned +Status: Feedback -Assigned To: derick +Assigned To:
 [2011-05-19 18:30 UTC] philip@php.net
I think people here are now confusing PhD with PhP. Also, I think this bug is 
fixed in SVN. :)

@kvz Is this still an issue?
 [2011-06-07 15:32 UTC] demian dot katz at villanova dot edu
First of all, apologies for being confused about Phd vs. PHP -- I assumed since this is a bug tracker on PHP.net that it was simply a typo in the heading!

Secondly, my bug turns out to be a simple typo in the .ini file -- despite the fact that I checked and triple checked, I missed the fact that I had a space in place of an underscore!  Still a mystery why the CLI version complained more persistently about this than the Apache version, but I'm not too concerned.

Once again, sorry for putting this in the wrong place AND complaining about a bug that was really just my own bad eyes -- but I figured I might as well bring closure to the issue in the same place I brought it up, just in case somebody else finds themselves following the same path that I did.
 [2011-06-07 15:40 UTC] philip@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: philip
 [2011-06-07 15:40 UTC] philip@php.net
Thank you for the open and honest reply, and this happens (and will continue to 
[occasionally] happen) to all of us. :)
 [2011-10-02 02:06 UTC] xmoravka at seznam dot cz
I found out that date.timezone option is without any effect, if php finds any syntax error on any row in php.ini file.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 02:01:30 2024 UTC