[Ilugc] Apache - PHP

  • From: girishvenkatachalam@xxxxxxxxx (Girish Venkatachalam)
  • Date: Fri Aug 1 15:06:42 2008

On 13:05:42 Aug 01, dharanivasan dharanivasan wrote:

Dear Friends ,
Please tell me how Apache communicate with PHP . I know Web server <--> Web
browser request/response . But don't know how  Apache response PHP
files(Preprocessed HTML). Where PHP resides between Apache &  web-browser .

It is something like this.




   +---------------+              +------------+
   |               |              |   Apache   |
   | web browser   | ---------->  | Web Server | \
   |               |              +------------+  \  
   +---------------+                               \
                                                    \    CGI is 
                                                     | part of Apache's
                                                     | address space
                                                     |
                                                     |
                                                     v
                                                +------------+
                                                |            |
                                                |    CGI     |
                                                |  backend   |
                                                |            |
                                                |            |
                                                +------------+

                                                /   |   \ (local sockets,
                                               /    |    \         TCP/IP)
                                              /     |     \
                                          PHP          Perl          C or shell
                                                           script


Please view this diagram with the firefox browser. ;)

Or better still view it with a mail client. Otherwise it will be 
broken mishmash of ASCII characters.

Coming to the point, the Apache web server communicates with active
content in the CGI either using a module or it may even be built in.

Apache protects the static content from getting trampled by dynamic
content(dangerous) using its own separation and security mechanisms.

Now you can create a universe with a CGI programs. ;)

Which is to say it is really very powerful. You can implement a search
engine (Obviously google also has to do it this way, no other choice),
or you could do various server side processing like accessing a
database, processing a user supplied form and so on.

The CGI interface gives you the choice to implement the server side
processing either using perl or PHP or shell script or even C.

You can even implement an IPC mechanism like UNIX domain sockets or even
network sockets between CGI backend and the CGI script (see above).

-Girish

Other related posts: