看完之後這個答案,我決定將我的伺服器上的httpd的MPM改為worker。但在編輯時/etc/sysconfig/httpd
,我注意到這個評論:
# The default processing model (MPM) is the process-based
# 'prefork' model. A thread-based model, 'worker', is also
# available, but does not work with some modules (such as PHP).
# The service must be stopped before changing this variable.
#
#HTTPD=/usr/sbin/httpd.worker
我可能理解錯誤,但這不是告訴我工人會不是與 mod_php 一起使用嗎?因為這就是我目前正在使用的。
伺服器運行 CentOS 6.4 和 Apache 2.2。
答案1
不 - 你不能 - 你會遇到神秘的錯誤和崩潰,因為 PHP 不是線程安全的。
但是您可以將worker-mpm 用於靜態檔案以及類似的內容php_fcgi
或僅針對PHP 的另一個httpd 實例的反向代理。
我正在使用後者 - 它允許我運行多個網站 - 所有網站都在 CentOS 6 上具有不同的權限和配置。
答案2
據我所知,mod_php 不是線程安全的。