Possible Duplicate:
I never really understood: what is CGI?
In the lighttpd config, we define two paths (as shown below), one of them is the binary of PHP, the other is the socket path. My question is, in which point does the lighttpd fetches the final HTML output created by PHP? Does the binary give an output to lighttpd as a response? Or does it create a temporary file in another place and server fetches it?
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket"
)))
PHP can run as a CGI binary, or as an Apache module. When being used as a CGI binary, the HTTP server will communicate with PHP via pipes or named pipes. These can utilize stdout which is a form of interprocess communication which does not require any disk access. If run as an Apache module, PHP is effectively part of the Apache server. This is significantly faster than being executed as a CGI, but has some security limitations.
From my understanding, the bin-path
is used to fire up the FastCGI server (if it's not started yet) whereas the socket
is used to proxy the request into the server once started.
The final HTML is therefore pulled from /tmp/php.socket
after the request has been processed; it's a named pipe as opposed to a network socket but they're quite similar in any other respect.
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