Thursday, June 18, 2009

Ways of utilizing PHP by a web server

There are three ways a web server can utilize PHP to generate web pages:
  • CGI wrapper
  • Module in a multiprocess web server
  • Plug-in for a multi-threaded web server
CGI wrapper:

The first method is to use PHP as a CGI wrapper. In this case. an instance of the PHP interpreter is created for every page request. The page is offcourse a PHP page. The instance is destroyed after the request is served.

Module in a multiprocess web server:

A multiprocess server typically has one parent process which coordinates a set of child processes. The child processes actually do the serving up web pages. when a request comes from a client, one of the children, who is not serving any client at that moment, is allocated to serve the request. This means that when the same client makes a second request to the server, it may be served by a different child process than the first time. This method currently includes Apache web server. This is the most popular method.

Plug-in for a multi-threaded web server:

This method uses PHP as a plug-in for a multithreaded web server. Currently PHP 4 has support for ISAPI, WSAPI, and NSAPI (on Windows), which all allow PHP to be used as a plug-in on multithreaded servers like Netscape FastTrack (iPlanet), Microsoft's Internet Information Server (IIS), and O'Reilly's WebSite Pro. The behavior is essentially the same as for the multiprocess model.

No comments: