How does PHP interface with Apache?

后端 未结 4 757
梦如初夏
梦如初夏 2020-12-13 07:23

I\'ve almost finished writing a HTTP/1.0 compliant web server under Java (no commercial usage as such, this is just for fun) and basically I want to include PHP support. I r

4条回答
  •  执念已碎
    2020-12-13 07:35

    There are 3 ways PHP can be invoked from Apache:

    1) as a module - this involves linking the php interpreter against a library of hooks published by the webserver

    2) CGI - the webserver starts up an instance of the interpreter for each request and passes parameters to the interpreter via stdin, the command line and environment variables, stdout is sent to the client and stderr should be written to the error_log

    3) fastCGI - this eliminates the overhead of starting a new process for each request - the interpreter runs as a daemon

    CGI is the simplest to implement but does not scale/perform well, the module would be the hardest by far. FastCGI is nearly as fast as the module approach. CGI and fastCGI are open, well documented APIs.

    There are other ways of achieving your goal - e.g. Quercus

    C.

提交回复
热议问题