1

At the moment i am trying to make a symfony app, but it gave me an error and couldn't start it's server when using the server:run command. It said that it couldn't run because of the timezone. If I change the timezone in the default php.ini file on a mac, it still gives me the 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_timezo
ne_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.

Can someone help me? I tried a lot, but can't figure this one out.

I want to change the timezone in the php.ini file that is being used by Symfony. But i don't know what i am doing wrong.

Oussama
  • 425
  • 1
  • 5
  • 7
  • are you sure to use the right php.ini? are you sure it's not overwritten by the set function? are you sure the desired time zone is supported by your system? – LBA Jun 03 '16 at 09:30
  • I think it's a duplicate question, http://stackoverflow.com/questions/20743060/symfony2-and-date-default-timezone-get-it-is-not-safe-to-rely-on-the-system/20743237#20743237 – sas Jun 03 '16 at 13:14

1 Answers1

7

you can set it in your AppKernel (app folder):

class AppKernel extends Kernel
{
    // the usuals.....    

    // Add this

    public function __construct($environment, $debug) {
      date_default_timezone_set('Europe/Warsaw');
      parent::__construct($environment, $debug);
    }

}