PHP官方建议我们不要使用Worker模式下的Apache2来运行PHP

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值