Php – Stop Warning: date() [function.date]: from localhost

datePHPtimezonewarnings

Warning: date() [function.date]: 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 …………

There are many web applications that spring up this particular error. I could set

date_default_timezone_set('America/Los_Angeles');

But that is not the solution I am looking for.

Can I do something from system level. It happens only on LOCALHOST not on the actual production server.

Default set in php.ini is date.timezone = America/Los_Angeles

[update] edited php.ini

Warning: phpinfo() [function.phpinfo]: 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

Best Answer

The reason it is happending on one server and not the other is the php.ini setting date.timezone=.

You would still need to pick an actual value though. You assuredly don't have one. Or in the wrong php.ini version (there's one for CLI and one for mod_php).