Background: Intranet CMS running on a Windows Server. Occasionally users complain that some reports they generate from the intranet don't contain the configured setlocale
for that script. This means that instead of getting März
(German) they get March
(English).
Right on top of the PHP script I have:
setlocale(LC_TIME, 'de_DE','deu');
and this returns string(19) "German_Germany.1252"
And this works just fine in 99,9% of the time.
On on the PHP page there is the following warning:
The locale information is maintained per process, not per thread. If you are running PHP on a multithreaded server API like IIS or Apache on Windows, you may experience sudden changes in locale settings while a script is running, though the script itself never called setlocale(). This happens due to other scripts running in different threads of the same process at the same time, changing the process-wide locale using setlocale().
Now what does this mean for me? That in the split second that the script executes, some other script overrides my setting and sets in to English?
Anyway, how to overcome this in a decent way?
N.B. There are similar questions regarding this, but they don't quite answer my question.