In the client browser towards the Apache httpd webserver there's a obvious defined protocol, HTTP, via TCP/IP (electrical sockets). I am getting difficult time to know what funnel/protocol can be used in the Apache httpd webserver to Perl or PHP or CGI? Could it be Inter-Process Communication via electrical sockets or pipse or message queue or signals? Could someone reveal what's really happening behind the scene? Could it be as though the Apache httpd webserver executes another program (Perl or PHP) and captures the output after which resends it to client browser?

From Linux Server Security:

The CGI protocol does not specify the way the web server should talk to the CGI program. There has been two primary solutions:

Stand alone CGI programs

Apache gets to be a CGI request, opens a 2-way pipe for an exterior program, transmits it the CGI input data, and returns the program's output towards the client. Like a separate process, this program can crash without lowering the net server. The lower side is the fact that it's relatively slow to begin a brand new process.

Built-in CGI programs

This program is rewritten being an Apache module and incurs its startup cost only if an Apache process begins. This really is considerably faster than an exterior program and can access Apache's internals along with other modules. Typically the most popular modules for CGI in Apache would be the interpreter engines for Perl (mod_perl) and PHP (mod_php).

Communication with CGI programs is performed via two channels: simple IO redirection (that's, STDIN and STDOUT) and atmosphere variables.

The HTTP server transmits the request towards the CGI's STDIN. It reads the HTTP response in the CGI's STDOUT and transmits it (slightly modified) towards the client browser. Additional server data (such as the request size or some server parameters) are going to atmosphere parameters that always begin with HTTP_.