Fix timezone settings for PHP on Mac OSX El Capitan for Symfony

November 27, 2015 by in code

Symfony requires you to specify a date.timezone in the ini file. The problem is, Mac uses it’s own install of PHP, and you need to create directory structure it searches for the ini file… and a php.ini file. Here’s how you do it.

1. Open terminal
2. nano /Library/Server/Web/Config/php/php.ini
3. add line date.timezone = “Europe/London” (Other timezones)
4. Save & exit.

The original error:

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.
1 Comment
  • October 18, 2016

    Ooooook, thank you SO MUCH for this post. I was using a manually installed version of PHP and it was working well, but then I installed PHP5.6 using Homebrew instead of installing it manually like I did for the previous, and of course I got this error. I think I read many issues on Stackoverflow and I modified at least 3 php.ini before I found your post. Thanks again !

Leave a comment

Your email address will not be published. Required fields are marked *