Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Notice: date_default_timezone_set(): Timezone ID '' is invalid #8102

Closed
frankiecmk opened this issue Mar 23, 2015 · 22 comments
Closed

PHP Notice: date_default_timezone_set(): Timezone ID '' is invalid #8102

frankiecmk opened this issue Mar 23, 2015 · 22 comments

Comments

@frankiecmk
Copy link

[Mon Mar 23 02:31:33.059828 2015] [:error] [pid 3372:tid 139994861631232] [client 172.16.10.180:58471] PHP Notice:  date_default_timezone_set(): Timezone ID '' is invalid in /export/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php on line 41
[Mon Mar 23 02:31:35.617828 2015] [:error] [pid 3372:tid 139994861631232] [client 172.16.10.180:58471] PHP Fatal error:  Uncaught exception 'ErrorException' with message '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 misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in /export/htdocs/vendor/monolog/monolog/src/Monolog/Logger.php:248\nStack trace:\n#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'date_default_ti...', '/export/gw.molp...', 248, Array)\n#1 /export/htdocs/vendor/monolog/monolog/src/Monolog/Logger.php(248): date_default_timezone_get()\n#2 /export/htdocs/vendor/monolog/monolog/src/Monolog/Logger.php(543): Monolog\\Logger->addRecord(400, 'exception 'Erro...', Array)\n#3 /export/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Han in /export/htdocs/vendor/monolog/monolog/src/Monolog/Logger.php on line 248
[Mon Mar 23 02:31:36.783063 2015] [:error] [pid 3372:tid 139994861631232] [client 172.16.10.180:58471] PHP Fatal error:  Uncaught exception 'ErrorException' with message '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 misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in /export/htdocs/vendor/monolog/monolog/src/Monolog/Logger.php:248\nStack trace:\n#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'date_default_ti...', '/export/gw.molp...', 248, Array)\n#1 /export/htdocs/vendor/monolog/monolog/src/Monolog/Logger.php(248): date_default_timezone_get()\n#2 /export/htdocs/vendor/monolog/monolog/src/Monolog/Logger.php(543): Monolog\\Logger->addRecord(400, 'exception 'Symf...', Array)\n#3 /export/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Han in /export/htdocs/vendor/monolog/monolog/src/Monolog/Logger.php on line 248
  • laravel/framework (v5.0.18)

@taylorotwell i am getting this error, please rectify.

@overtrue
Copy link
Contributor

config/app.php:

'timezone' => 'UTC',

@frankiecmk
Copy link
Author

'timezone' => env('APP_TIMEZONE'),

@overtrue i did set in config/app.php and .env file APP_TIMEZONE=Asia/Kuala_Lumpur

@overtrue
Copy link
Contributor

dd(env('APP_TIMEZONE')) ?

@frankiecmk
Copy link
Author

@overtrue it shows Asia/Kuala_Lumpur, the error is only happen when there is a huge spike on traffic.

@overtrue
Copy link
Contributor

try add a default value:

'timezone' => env('APP_TIMEZONE', 'Asia/Kuala_Lumpur'),

@phanan
Copy link
Contributor

phanan commented Mar 23, 2015

This is often seen when you have subdir(s) with the same file names under config dir, since Laravel 5 dropped cascading support. I thought this has been fixed since 5.0.3 though.

@frankiecmk
Copy link
Author

@overtrue it works fine, but without the default value will prompt error if there is huge spike of traffic.

@frankiecmk
Copy link
Author

@phanan: there is no same file names under config dir.

@phanan
Copy link
Contributor

phanan commented Mar 23, 2015

Hmm... Try logging config('app') under huge spike of traffic and see what's there, then? If it's empty, maybe your app has some problem loading the config files under such circumtances.

@crynobone
Copy link
Member

Probably need more detail, version used, opcache (could cause issue) or even might be related to #7354

@frankiecmk
Copy link
Author

@crynobone Yes, this is related to #7354 due to PHP thread-safe i guess.

@crynobone
Copy link
Member

There isn't any workable solution right now, #7425 was merged but later reverted due to regression bug 866a8cf#commitcomment-9767647

@jebog
Copy link

jebog commented Jan 21, 2016

Please check your php.ini date.timezone directive

@masonfox
Copy link

masonfox commented Sep 15, 2016

I'm getting this on a windows machine:

date_default_timezone_set(): Timezone ID 'Enter the new date: (mm-dd-yy)' is invalid

config/app.php = 'timezone' => 'UTC',

@ghost
Copy link

ghost commented Apr 14, 2017

date_default_timezone_set('UTC')

@stadeli
Copy link

stadeli commented Jul 11, 2019

How do we know which one of the 20 suggested answers is the correct one???

@mashum
Copy link

mashum commented Nov 16, 2020

By using function timezone_identifiers_list(); will confirm the timezone supported in php use this if(!in_array('your timezone', $zoneList)) { set default timezone here }

@judegoz
Copy link

judegoz commented Mar 9, 2021

config/app.php:

'timezone' => 'UTC',

i did same but still fatal error

@sekroots
Copy link

Any solution about this issue?

@sekroots
Copy link

?

1 similar comment
@sekroots
Copy link

?

@sekroots
Copy link

PHP Notice: date_default_timezone_set(): Timezone ID 'Europe/London # you should change this to your timezone' is invalid in /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php on line 49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests