I have a problem with a PHP script sometimes triggering weird warnings in the Apache error log :
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)
Below is the code generating this warning. (it is used to configure 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);
The weird thing is that the warning does not systematically appear. If I restart Apache, it will not appear for some minutes (i.e. serving hundreds of requests without any warning) and then it will progressively start appearing.
Thank you