It is not safe to rely on the system's timezone settings, but only sometimes.
by Markus Malkusch
Posted on Friday May 08, 2015 at 09:47PM in Technology
Since version 5.4 PHP is yelling about the missing configuration setting
Warning: date(): 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone.
Back in the days my first reaction was: Why? I do configure the system's timezone and indeed would consider not doing so a bad idea, but why does PHP think it needs its own timezone setting? The motivation for this annoyance can be found in the PHP-INTERNALS:
you, as an admin, are required to make an informed decision on what you want your timezone to be. There have been way too many bug reports where people had no clue, so now we throw a warning.
Now after zillions of such warnings I just got used to it and configure it like a good sheep. But what is this? There's this killer feature function
easter_date() uses the TZ environment variable to determine the time zone it should operate in, rather than using PHP's default time zone.