-
Notifications
You must be signed in to change notification settings - Fork 1
Why phpfcgi
FastCGI's primary advantage over standard CGI is the fact that it moves the runloop in. Here's some simple explanations of what I mean by that
##Standard CGI
- Load interpreter
- Load primary script file
- Load required secondary script files
- Instantiate objects to handle request
- Handle request
- Done
##FastCGI
- Load interpreter
- Load primary script file
- Load required secondary script files
- Instantiate objects to handle request
- Handle request
- Repeat previous step multiple times
- Done
As you can see, FastCGI can greatly speed up script execution by allowing multiple requests to be handled by a single load of the interpreter and script files, and, for some objects, a single instantiation. This is what I refer to as the runloop. For standard CGI, the runloop is the entire list, every step has to happen to service each request. FastCGI moves the runloop to just a single step, and processes multiple requests in that runloop
Unfortunately, this is only the case for certain scripting languages, like Perl, Python and Ruby. PHP's FastCGI support is rather different. Rather then moving the runloop to user code, the current PHP FastCGI solution is to only do away with loading the interpreter. Everything else is still a part of the runloop. That's where this project comes in. I've written support for running a FastCGI runloop inside of PHP. It's still in development, and is incompatible(and probably going to stay that way) with standard CGI PHP scripts, but I think that it could show some rather impressive advantages in some circumstances.