Skip to content

Instantly share code, notes, and snippets.

@amonmoce
Created October 12, 2014 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amonmoce/c16878f155bfb5173f9f to your computer and use it in GitHub Desktop.
Save amonmoce/c16878f155bfb5173f9f to your computer and use it in GitHub Desktop.
Cannot run php app/console ... when I do so I have a problem related to date_default_timezone_get ....
Symfony 2 error:
======================
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: date_default_timezone_get(): 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 misspelle
d the timezone identifier. We selected the timezone 'UTC' for now, but ple
ase set date.timezone to select your timezone. in /Users/amonmoce/Document
s/Web/www/ZakafricaProject/vendor/monolog/monolog/src/Monolog/Logger.php l
ine 233
====================
Solution:
I just went to the indicated file and I added the 2nd line ...
if (!static::$timezone) {
date_default_timezone_set('Asia/Taipei');
static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
}
@andresfelipegarcia
Copy link

Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment