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

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.  

3 comments on “Fix timezone settings for PHP on Mac OSX El Capitan for Symfony

  1. 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 !

  2. Hey There. I found your blog the use of msn. That is a really
    well written article. I will make sure to bookmark it and return to read more of your useful info.
    Thank you for the post. I will definitely comeback.

Leave a Reply

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