Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timezone with symfony 2

I've got some troubles whith Symfony 2, trying to generate schema via :

php console/app generate:schema:create

I've got a pretty error :

[Exception]                           
DateTime::__construct(): 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 'Europe/Berlin' for 'CEST/2.0/DST' instead

Thus, I'm trying to change the timezone in my php.ini with

date.timezone = 'Europe/Paris'

but even if I'm reloading my apache, I still get

date.timezone   Europe/Zurich   Europe/Zurich

if I look at my phpinfo(), so I don't really know what should I try next ... And I'm not even sure that I'm in the good way.

Thanks for helping me

like image 593
Saperlipopette Avatar asked May 31 '11 21:05

Saperlipopette


3 Answers

On mac, if you have /etc/php.ini.default, do

sudo cp /etc/php.ini.default /etc/php.ini 

and then do

php --ini 

to see that it now loads a php.ini file.

like image 197
Jonathan Avatar answered Sep 26 '22 03:09

Jonathan


this that trick

and se /etc/php5/cli/php.ini and /etc/php5/apache2/php.ini

datetime = 'America/Lima' for example

and run command

$ sudo apt-get install php5-sqlite 
$ sudo /etc/init.d/apache2 restart
like image 39
danilo Avatar answered Sep 22 '22 03:09

danilo


Some third-party distributions of PHP (including MAMP) have hard-coded the timezone. For instance, MAMP 2.0 is hard-coded to Europe/Berlin, and there is no way to change this. Even changing the value in the php.ini template has no effect, because MAMP overwrites your value. Are you using PHP from source, a pre-compiled package, or PHP as a part of some kind of LAMP stack?

like image 44
Johntron Avatar answered Sep 25 '22 03:09

Johntron