PHP Warning: PHP Startup: 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 'America/Los_Angeles' for '-8.0/no DST' instead in Unknown on line 0
I am running PHP 5.3.0 on my Windows XP, and have spent the better part of the day to try to get rid of this warning and finally managed to do it. How, you say?
The breakthrough came after I have read this instructions from the PHP web site Changes in PHP datetime support. Here is part of it:
Since PHP 5.1.0, there has been an extension named date in the PHP core. This is the new implementation of PHPâ€™s datetime support. Although it will attempt to guess your systemâ€™s timezone setting, you should set the timezone manually. You can do this in any of three ways:
- in your php.ini using the date.timezone INI directive
- ion your system using the TZ environmental variable
- ifrom your script using the convenience function date_default_timezone_set()
All supported timezones are listed in the PHP Manual.
Notice that you can set your systemâ€™s timezone setting using php.ini, set TZ environment variable or from your php script.
The first option did not work for me. The third option does not work for php scripts that are not written by me, so the only option left is to set environment variable TZ. That finally saved the day!
On Windows XP:
- go to My Computer
- View System Information
- Advanced Tab
- Environmental Variables
- Add New Variable with name â€˜TZâ€™ and value whatever your timezone is. In my case is â€˜America/Los_Angelesâ€™.
Thatâ€™s it. I hope this saves somebody few hours of searching.