menu

开发进行时...

crazy coder

Avatar

It is not safe to rely on the system's timezone settings

PHP Warning: Unknown: 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 'Europe/Moscow' for 'MSK/3.0/no DST' instead in Unknown on line 0
phpinfo()
PHP Version => 5.3.4


two ways to fix it:

add date_default_timezone_set ('Asia/Shanghai'); to your php file.
// or date_default_timezone_set("PRC");

another way:
define your timezone in your php.ini like this:
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = 'Asia/Shanghai'

additional tip you should know:
List of Supported Timezones

sinzy 这里是我手工指定的时区。服务器在洛杉矶,每次改夏令时的时候我还得更新一下 config。:p