2

I've never seen phpinfo() give errors before. What gives? What should I look for in php.ini?

Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the system's 
timezone settings. You are *required* to use the date.timezone setting 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 'America/New_York' for 'EDT/-4.0/DST'
instead in /Users/{me}/Sites/localmirror/htdocs/tests/phpinfo.php on line 3

offending file:

<?php

phpinfo();

?>

edit: Ah, glimmer of understanding, the warning means I need to set "date.timezone" in php.ini. I thought they were talking about "you" the php programmer, instead they're talking about "you" the sysadmin.

4 Answers 4

2

Do you still get the same error with something like this?

<?php
if(date_default_timezone_set('Europe/Stockholm') == 0) {
            print "<!-- Error uknown timezone using UTC as default -->\n";
            date_default_timezone_set('UTC');
}
phpinfo();
?>
1

the answer was to comment out the line date.timezone = ... in my php.ini file and add the appropriate timezone ("US/Eastern" in my case). I guess I was missing the obvious.

0

You may see this as a nuisance but from my point of view it should be required, as I rely a lot on the managing time zone in my PHP applications when inserting dates into MySQL databases, as well as being able to allow changes to the time zone from the user's view, as a server might be placed in New York, while my client would like all his dates to be kept according to Los Angeles time.

This is just my take on it, and you can always switch down to 5.2.xx if you don't want to have this sort of problem, or start setting it in your php.ini or your application.

1
  • um... could you tell me what "it" is? (e.g. how do I set php.ini accordingly?)
    – Jason S
    Oct 17, 2009 at 22:40
-2

This is an another php disaster, indeed, how to hell be that stupid not rely on the systemwide settings? php is going now to a miserable direction.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .