Php linux和i18n上的Apache:生成进程还是线程?

Php linux和i18n上的Apache:生成进程还是线程?,php,localization,apache2,Php,Localization,Apache2,我想更准确地了解linux上的Apache在进程预分叉模型中接收HTTP请求时发生的情况 假设我们有20个Apache子进程在等待 当我收到一个HTTP请求时,是否可以说将选择一个子进程来处理该请求,并且在第一个请求完成之前,该进程不会处理来自另一个用户的另一个请求 我提出这个问题是因为PHP的一个限制: The locale information is maintained per process, not per thread. If you are running PHP on a mu

我想更准确地了解linux上的Apache在进程预分叉模型中接收HTTP请求时发生的情况

假设我们有20个Apache子进程在等待

当我收到一个HTTP请求时,是否可以说将选择一个子进程来处理该请求,并且在第一个请求完成之前,该进程不会处理来自另一个用户的另一个请求

我提出这个问题是因为PHP的一个限制:

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().

通常,如果使用mpm prefork,每个PHP实例都有自己的进程,因此 更改区域设置是安全的,如果使用mpm worker或mpm event,则不安全

另外,如果您在任何服务器后面以fastcgi进程的形式运行PHP,它也会分叉,并且每个连接都有进程。所以它也应该是安全的

注:

  • 在运行PHP时,通常没有理由不在Linux下使用mpm prefork
  • 在windows下没有“fork”这样的东西,所以apache在windows下是多线程的