Multi-language PHP website with gettext: locales mixed up or lost
One of our websites is using gettext for displaying dutch and french language. Based on the host header, we define the locale/environment variable. Sometimes it seemed that the locale and the environment variables were getting lost.
After some testing we found the problem, just look at the warning on the PHP website:
"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 of locale settings while a script is running although the script itself never called setlocale() itself. This happens due to other scripts running in different threads of the same process at the same time changing the processwide locale using setlocale()."
So when requests of the dutch site are running at the same time as request on the french site, the locale was getting mixed up. The chance of this problem occuring, gets bigger when requesting slower pages. The problem might not be visible when all pages are fetched very fast.
Solution? Put each website in his own app pool, or move to Linux