I have been trying to understand the exact meaning/purpose of loading php as an apache module vs the rest.
我一直试图理解加载php作为apache模块与其余模块的确切含义/目的。
When php is installed as an apache module, what exactly happens? For example, does reading the php-ini file happen every time the php request comes or when the php module is loaded alone?
当php作为apache模块安装时,究竟会发生什么?例如,每次发出php请求或单独加载php模块时,是否会读取php-ini文件?
3 个解决方案
#1
23
php.ini is read when the PHP module is loaded in both mod_php, FastCGI and FPM. In regular CGI mode, the config file have to be read at runtime because there's no preforked processes of any kind.
在mod_php,FastCGI和FPM中加载PHP模块时,将读取php.ini。在常规CGI模式下,必须在运行时读取配置文件,因为没有任何预先准备好的进程。
I think the only real advantage of running PHP as a module inside the web server is that the configuration might be easier. You get a lot better performance when you run it in FastCGI or FPM mode and can use a threaded or evented (instead of forked) Apache, or when you can throw out Apache altogether.
我认为在Web服务器中运行PHP作为模块的唯一真正优势是配置可能更容易。当您在FastCGI或FPM模式下运行它时,您可以获得更好的性能,并且可以使用线程或事件(而不是分叉)Apache,或者当您完全抛弃Apache时。
#2
13
This link may help: http://2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html
此链接可能有所帮助:http://2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html
Conclusion
结论
If pure speed is what you are after, then stay with mod_php.
如果纯粹的速度是你所追求的,那么请使用mod_php。
However, for better resource usage and efficiency, consider moving to fcgid.
但是,为了更好地利用资源和效率,请考虑转移到fcgid。
#3
2
php.ini is read when the module is loaded in the case of an Apache module. PHP CGI uses a php interpreter executable like any other shell script would do. Since there is no state involved at each invocation, the config file would have to be read every single time in case of CGI.
在Apache模块的情况下加载模块时会读取php.ini。 PHP CGI像任何其他shell脚本一样使用php解释器可执行文件。由于每次调用都不涉及状态,因此在CGI的情况下,每次都必须读取配置文件。
#1
23
php.ini is read when the PHP module is loaded in both mod_php, FastCGI and FPM. In regular CGI mode, the config file have to be read at runtime because there's no preforked processes of any kind.
在mod_php,FastCGI和FPM中加载PHP模块时,将读取php.ini。在常规CGI模式下,必须在运行时读取配置文件,因为没有任何预先准备好的进程。
I think the only real advantage of running PHP as a module inside the web server is that the configuration might be easier. You get a lot better performance when you run it in FastCGI or FPM mode and can use a threaded or evented (instead of forked) Apache, or when you can throw out Apache altogether.
我认为在Web服务器中运行PHP作为模块的唯一真正优势是配置可能更容易。当您在FastCGI或FPM模式下运行它时,您可以获得更好的性能,并且可以使用线程或事件(而不是分叉)Apache,或者当您完全抛弃Apache时。
#2
13
This link may help: http://2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html
此链接可能有所帮助:http://2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html
Conclusion
结论
If pure speed is what you are after, then stay with mod_php.
如果纯粹的速度是你所追求的,那么请使用mod_php。
However, for better resource usage and efficiency, consider moving to fcgid.
但是,为了更好地利用资源和效率,请考虑转移到fcgid。
#3
2
php.ini is read when the module is loaded in the case of an Apache module. PHP CGI uses a php interpreter executable like any other shell script would do. Since there is no state involved at each invocation, the config file would have to be read every single time in case of CGI.
在Apache模块的情况下加载模块时会读取php.ini。 PHP CGI像任何其他shell脚本一样使用php解释器可执行文件。由于每次调用都不涉及状态,因此在CGI的情况下,每次都必须读取配置文件。