2010-04-09 52 views
0

我想更好地了解当Linux上的Apache在进程前叉模型中接收到HTTP请求时发生了什么。Linux和i18n上的Apache:产卵进程或线程?

比方说,我们有20个Apache子进程等待。

当我收到一个HTTP请求,是这样说,1个儿童进程将被选择来处理请求,并且直到第一个完成这个过程不会处理来自其他用户的另一个请求?

我问,因为这指明了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(). 

回答

0

一般来说,如果你有MPM-prefork的工作,每个PHP实例都有自己的过程,因此 是安全的,改变区域设置,如果你与mpm-worker或mpm-event一起工作,那么你是不安全的。

此外,如果你运行PHP作为FastCGI进程背后的任何服务器它叉,以及和它有每个连接的过程。所以它也应该是安全的。

注:

  • 一般没有理由不运行PHP时,Linux下使用MPM-prefork的。
  • 在windows下没有“fork”这样的东西,所以apache在Windows下是多线程的