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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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, ormod_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_phpis the solution that’s used the most.