Warning about system timezone

Warning about system timezone

by James Moe -
Number of replies: 4
I'm getting a load of these errors in the httpd error log:

[Sun Aug 29 20:54:22 2010] [error] [client 192.168.69.115] PHP Warning: mktime(): 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/Denver' for 'MST/-7.0/no DST' instead in /d500g/www/courses/moodle/calendar/lib.php on line 976, referer: http://courses.sma.com/moodle/

date() and strftime() are other popular functions that generate this type of error.

The system and users all have an explicit timezone set. I have debugging enabled.

Is this expected?

What can be done about it?

Average of ratings: -
In reply to James Moe

Re: Warning about system timezone

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hi James,

this is due to a new behaviour in PHP 5.3.x versions. You need to set the server timezone in your php.ini or with a call to date_default_timezone_set() function. As Moodle doesn't use the later, you are supposed to edit your php.ini file and set the timezone there. You should talk to the server administrator to make the changes.

Saludos.
Iñaki.
Average of ratings: Useful (1)
In reply to Iñaki Arenaza

Re: Warning about system timezone

by James Moe -
Ah! Yes, that was it. I had thought it was a Moodle error message.

On a vaguely related subject: Do you know what the PHP "date.sunrise_zenith" is? The PHP site defines it as "The default sunrise zenith," a useless tautology.

I am guessing the units are degrees, but from what reference point? And how can something on the horizon have zenith?

In reply to James Moe

Re: Warning about system timezone

by Hubert Chathi -
It seems to be the location of the sun in the sky at which the centre of the sun must crosses for sunrise. There are several different definitions for sunrise (and sunset), depending on how much of the sun has risen, or how much sunlight is scattered. See http://en.wikipedia.org/wiki/Twilight The reference point is directly overhead.