我試圖在我的服務器上安裝PHP application。但我得到這個錯誤:PHP的問題 - 設置時區時的安全模式錯誤
Warning: putenv() [function.putenv]: Safe Mode warning: Cannot set environment variable 'PHP_TZ' - it's not in the allowed list in .../public/timezone.inc on line 14
我找到了有問題的文件和代碼段(下面)。我將如何修復此代碼? PHP_TZ應該做什麼?爲什麼PHP不喜歡它?我能做些什麼呢?
//set the timezone
if ($configdata["timezone"] != "") {
putenv("PHP_TZ=" . stripslashes($configdata["timezone"]));
putenv("TZ=" . stripslashes($configdata["timezone"]));
//for >= PHP 5.1
if(function_exists("date_default_timezone_set")) {
date_default_timezone_set($configdata["timezone"]);
}
我在PHP 5.2.10上。我爲$ configdata [「timezone」]的值嘗試了'歐洲/蘇黎世'和'UTC',並得到了同樣的錯誤。