2
votes

I have researched all the answers I can find for this and have had no luck getting it to work.

I am getting the following error when I try to run symfony.

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 misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /symfony_project/app/cache/dev/classes.php line 5229

I have checked the following :

php --ini

Configuration File (php.ini) Path: /etc Loaded Configuration File:
/etc/php.ini

I have changed the ini file to date.timezone = "Europe/Dublin"

restarted apache Cleared the cli cache cleared the browser cache

Ran phpinfo and confirmed the

loaded config file is etc/php.ini Additional .ini files parsed (none) date.timezone = "Europe/Dublin" I also ran echo date_default_timezone_get() in the browser and I get Europe/Dublin

I am running PHP v 5.4.24 (for what its worth)

I ran echo date_default_timezone_get() inside which returns UTC ... so it looks like symfony is not reading the php.ini file properly.

Not sure what else I can do.

1
Do you have the error when running Symfony from command-line or server (in other words, viewing it in your browser)? And do you see the timezone when viewing phpinfo? - A.L
Take a look this post -> stackoverflow.com/a/20743237/453348 - tttony
Im getting the error in the browse when loading localhost:8000 - Barry McMahon
from php.ini date.timezone = Europe/Dublin - Barry McMahon
Ive also looked at that post ttony - Barry McMahon

1 Answers

-1
votes
  1. find your php.ini file path

    php -i | grep php.ini
    
  2. edit php.ini date_timezone set it is your timezone

    time_zone = "Asia/Shanghai"
    
  3. restart your nginx and php-fpm