1
votes

I'm trying to install a Symfony project on a new mac and I keep having this ErrorExeception:

[ErrorException] 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.

  1. I have already verified my PHP version using phpinfo();.
  2. The path for my php.ini is /Applications/MAMP/bin/php/php5.5.10/conf
  3. I opened my php.ini and I changed the date.timezone to date.timezone = "Europe/Paris"
  4. I restarted my MAMP many times and I keep having the same Error
  5. I also noticed that I have a php.ini.temp in the same folder. I also changed the date.timezone in this file but it still doesn't work.

Does anyone have an idea about what is happening?

Thanks!

3
Remeber you have two different php: one for web server and one for console. In console, ... try to run "$ php -i | grep ini" to find your console's php.ini file.sensorario
Thanks very much for your answer but in the meanwhile I found the answer to my problem. As you said, I was actually changing the php.ini file from the wrong php. A symbolic link solved my problem. If this can help someone: cd /usr/bin -> the bin folder where was the php I was using sudo mv php phpold -> changes the name of the php I was using sudo ln -s /Applications/MAMP/bin/php/php5.4.26/bin/php -> creates a symbolic link to the mamp php Now if I try ls, I have two phps in the bin folder (php and phpold). Everything works fine. ;)ana-lu

3 Answers

1
votes

You should simple add to your Symfony controller :

phpinfo();

and you will know where your php.ini is located and you should make sure you changed value in this file.

You should also consider setting timezone in your script:

date_default_timezone_set('Europe/Paris');

because you (or someone else) may simple change it in future to other timezone

0
votes

Symfony uses php command line (CLI) to make the install, so editing /etc/php5/apache2/php.ini will make no effect.

Try editing php-cli config. On debian:

vim /etc/php5/cli/php.ini
date.timezone = "Europe/Paris"

/etc/init.d/apache2 restart
-1
votes

$ su root

Enter root password

$ vim /etc/php.ini

Edit the timezone in this file