在安裝 ECSHOP 的時候,提示安裝失敗,提示信息如下:
Warning: date_default_timezone_get() [function.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 'UTC' for '8.0/no DST' instead in
install\includes\lib_installer.php
檢查 PHP 手冊,有注明:
Note:
Since PHP 5.1.0 (when the date/time functions were rewritten), every call to a date/time function will generate
a E_NOTICE if the timezone isn't valid, and/or a E_WARNING message if using the system settings or the TZ
environment variable.
造成 WARNING 原來是系統配置裡沒有設定默認時區,ECSHOP 調用 date_default_time_get (date/time 函數) 時則會產生錯
誤。在 php.ini 裡設定一下:
date.timezone = Asia/Shanghai
或在代碼裡加入 date_default_timezone_set ('Asia/Shanghai'); 即可解決