Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

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.

share|improve this answer

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.

share|improve this answer
    
um... could you tell me what "it" is? (e.g. how do I set php.ini accordingly?) –  Jason S Oct 17 '09 at 22:40

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();
?>
share|improve this answer
up vote 1 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.