What are the differences between mod_php and cgi php script?
I mean, why it's better (is it?) to use mod_php instead simple php scripts, running them as CGIs?
Thanks
When using CGI : a PHP process is launched by Apache, and it is that PHP process that interprets PHP code -- not Apache itself.
In theory, a distinct PHP process has to be created for each request -- which makes things slower : Apache has more work to do to answer a request.
(Well, as pointed out by @AlReece45 in a comment, this can be made better using FastCGI)
When using PHP as an Apache module (mod_php
, or mod_php5
), the PHP interpreter is kind of "embedded" inside the Apache process : there is no external PHP process.
Which means :
Generally speaking, I would say that mod_php
is the solution that's used the most.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With