Mod_php vs cgi vs fast-cgi

I tried to understand the exact meaning / purpose of loading php as an apache module and the rest.

When php is installed as apache module, what exactly happens? For example, does the php-ini file read every time a php request arrives or when the php module loads one?

+46
php interpreter fastcgi mod-php
Oct 17 '10 at 15:10
source share
3 answers

php.ini is read when the PHP module loads in both mod_php, FastCGI, and in FPM. In normal CGI mode, the configuration file must be read at runtime because there are no pre-processes of any type.

I think the only real advantage of using PHP as a module inside the web server is that the configuration could be simpler. You get much better performance when starting in FastCGI or FPM mode and you can use streaming or evented (instead of forked) Apache or when you can completely drop Apache.

+22
Oct 17 '10 at 15:22
source share

This link may help: http://2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html

Conclusion

If pure speed is what you need, then stay with mod_php.

However, for better resource utilization and efficiency, consider switching to fcgid.

+13
Sep 14 2018-11-11T00:
source share

php.ini is read when the module loads in the case of the Apache module. PHP CGI uses the php interpreter executable like any other shell script. Since the state is not involved in each call, the configuration file must be read every time in case of CGI.

+2
Oct 17 '10 at 15:25
source share



All Articles