Is mod_php walking on its road?
manlio_perillo at libero.it
Tue Oct 23 13:46:48 MSD 2007
Igor Sysoev ha scritto:
> On Tue, Oct 23, 2007 at 05:02:09PM +0800, Steve Chu wrote:
>> Does anybody here have a plan or already be writing a nginx
>> version mod_php that similar with apache's?
>> If nobody does, we are try to write one.
> I do not think that built-in nginx PHP will be better than Apache's one.
> For example, thttpd has PHP support, but all connections are blocked
> while PHP processes an request.
It should be possible to run the PHP code in a separate thread.
This is what I'm planning to to with mod_wsgi, in order to support
Here is the idea:
1) mod_wsgi creates a pipe and register the file descriptor with the
event module; it also creates a read event
2) mod_wsgi creates a worker thread (only one thread per worker process)
where the Python code will be executed
3) when the request handler is called, mod_wsgi setups the read event,
dispatches the "job" to the worker thread and returns control to
4) when the code execution is terminated, the thread writes a character
to the pipe.
This will calls an handler in the main thread that will retrieve the
"job" result, sending it to the client.
The "job" result is protected with a lock (the worker thread will
wait until the lock is released by the main thread).
Regards Manlio Perillo
More information about the nginx