FastCGI and PHP
r at roze.lv
Wed Apr 2 13:05:53 MSD 2008
> I understand that when started (in my case using spawn-fastcgi from the
> lighttpd project) php-fastcgi creates a master process and a number of
> child processes. Nginx then passes requests through to php-fastcgi,
> which processes the request and returns a response.
Correct. But to clarify - spawn-fcgi is not really required - php has all
the features allready in-built it just makes easier to start up.
> What I'm unsure on is whether nginx is passing the request directly to
> one of the child processes or the master process which then delegates.
nginx passes the requests to the ip/port (or you can also use unix sockets)
using the fastcgi protocol. More details:
php (its master process) handles its childs on its own.. then again there
are some caveats like php master process doesnt really know if all of the
childs are bussy and can't return FCGI_OVERLOADED (as from fastcgi spec).
> The reason I ask is that I have some useful components written in Eiffel
> which I'd like to make available via a webserver. I've found a small
> fastcgi server written in Eiffel, which I'd like to expand on to
> replicate the kind of through-put the php-fastcgi instance I'm running
It doesnt really matter as far as the service listening on the port "talks"
the Fastcgi protocol.
You can add as many backend handlers to nginx as you wish the only
limitation is you can't push a single request to all of them eg if you open
/index.php you can't handle it with php and some other fastcgi app the same
time but probably there is a possibility of a subrequest.
More information about the nginx