How to get around the PHP strftime() It is not safe to rely on the system's timezone settings warning


When I was playing around with the LogAnalyzer Statistics page I received the following error in each of the display boxes:

Warning: strftime(): 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
'EST/-5.0/no DST' instead in
/var/www/html/log/classes/jpgraph/jpgraph.php on line 390 Warning:
strtotime(): 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
'EST/-5.0/no DST' instead in
/var/www/html/log/classes/jpgraph/jpgraph.php on line 391

In the error message it provides two solutions to address this issue:

I went with #1 and set date.timezone to the following:

[Date]
; Defines the default timezone used by the date functions
;
http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = 'America/New_York'

I restarted Apache and everything is now working. I like easy fixes. :)

This article was posted by Matty on 2012-02-15 06:00:00 -0400 -0400