2010-04-09 51 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下是多線程的