0
我有一個PHP腳本有時在Apache的錯誤日誌觸發怪異的警告問題:在某些時候,服務器不能改變區域
bash: warning: setlocale: LC_ALL: cannot change locale (fr_FR.utf8)
bash: warning: setlocale: LC_ALL: cannot change locale (fr_FR.utf8)
bash: warning: setlocale: LC_ALL: cannot change locale (fr_FR.utf8)
bash: warning: setlocale: LC_ALL: cannot change locale (fr_FR.utf8)
下面的代碼生成此警告。 (它用於配置gettext)。
$lang='fr_FR.utf8';
$filename = 'default';
putenv("LC_ALL=$lang");
setlocale(LC_ALL, $lang);
bindtextdomain($filename, './config/locale');
bind_textdomain_codeset($filename, "UTF-8");
textdomain($filename);
奇怪的是,警告並沒有系統地出現。 如果我重新啓動Apache,它將不會在幾分鐘內出現(即沒有任何警告地提供數百個請求),然後它將逐漸開始出現。
謝謝
你讀[這](http://php.net/manual/ en/function.setlocale.php#refsect1-function.setlocale-notes)? – RobIII 2012-07-18 15:05:21
是的,我認爲這與我無關,因爲我的服務器上的Apache運行在prefork模式下 – David 2012-07-18 15:15:35