PHP只是一个粘合剂。他将众多的第三方模块儿库粘结到一起,然后提供给使用者一个直观易懂的统一语言接口,让我们觉得他们就是一个整体。PHP的易用和强大要依赖于一个稳定和强大的运行平台。他需要操作系统,Web服务器和第三方模块儿库融合到一起。他们当中任何一个挂了,PHP都需要通过各种途径迅速找到问题,并解决。如果我们使用一种没有完全隔离运行线程,没有完全隔离内存空间,并且没有一个强大的记录每个需求的容器的Web服务器来运行PHP时,PHP就会变的很容易出问题。
如果我们想使用一个多线程多进程的模块儿,可以关注一下PHP的FastCGI的配置。在FastCGI模式下,PHP运行在自己的内存空间里。
官方原文:
PHP is glue. It is the glue used to build cool web applications by sticking dozens of 3rd-party libraries together and making it all appear as one coherent entity through an intuitive and easy to learn language interface. The flexibility and power of PHP relies on the stability and robustness of the underlying platform. It needs a working OS, a working web server and working 3rd-party libraries to glue together. When any of these stop working PHP needs ways to identify the problems and fix them quickly. When you make the underlying framework more complex by not having completely separate execution threads, completely separate memory segments and a strong sandbox for each request to play in, further weaknesses are introduced into PHP's system.
If you want to use a threaded MPM, look at a FastCGI configuration where PHP is running in its own memory space.