dongqiao3927 2013-04-17 07:00
浏览 74

在Windows下,其他脚本改变了PHP setlocale?

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用
    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?