Theoretically, there are 3 options how PHP can be attached to nginx:
- Module. Currently, there's no nginx PHP module. Minus.
- CGI. PHP is spawned at every request, and a single php process parses a single php file. execve() overhead is obvious. Dirty Plus.
- FCGI. Pre-spawned processes which handle requests, and never stop. Plus.
There's 2 methods of creating these FCGI processes:
- Pre-launch them. That's what spawn_fcgi does, and that is okay.
- Let nginx launch them: nginx tries to connect to localhost:, and if there's nobody listening, spawns php FCGI workers. That would have been better in terms of administration comfort and stability, but I've never heard of such a module for nginx :) Maybe, you'll be the first one to develop it? ;)
spawn script is not evil, really :)
P.S. Походу, самый пытливый ум у русских ;)