[英]PHP Default Timezone issue on Fedora + Zend Server CE
我在Fedora VM上安裝了ZendServer CE(PHP 5.2),系統時區設置為“America / Chicago”。 我的php.ini文件中有date.timezone ='UTC',當我在網頁上調用date_default_timezone_get()或顯示日期('T')時,它會顯示'CDT'。
php.net for date_default_timezone_get()上的文檔說明在選擇默認時區時它遵循以下順序:
- Reading the timezone set using the
date_default_timezone_set() function
(if any)
- Reading the TZ environment variable
(if non empty)
- Reading the value of the
date.timezone ini option (if set)
- Querying the host operating system
(if supported and allowed by the OS)
如果我通過'setup'更改系統時區,並重新啟動服務器,date('T')將返回我更改系統時區的內容,無論php.ini是什么。 我也沒有TZ環境變量,我目前在代碼中的任何地方都沒有使用date_default_timezone_set()。
知道可能會發生什么嗎? 我意識到我總是可以通過調用date_default_timezone_set('UTC')覆蓋系統時區,但如果可能的話我寧願依賴php.ini文件。
謝謝您的幫助,
戴夫
我認為你有TZ設置,即使你認為你沒有。 請注意,請查看本教程以更好地了解TZ。
http://www.cyberciti.biz/tips/date-command-set-tz-environment-variable.html http://www.cyberciti.biz/faq/howto-linux-unix-change-setup-timezone-tz -變量/
還要嘗試查看用戶的.bashrc中的內容
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.