writing php scripts for fastcgi environments

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Bit of a conundrum.

The commercial linux hosting that a website uses has some sort of fastcgi
implementation that handles the php scripts. I've looked several times,
but my google fu is failing. I can find plenty of discussion relating to
fastcgi configuration, and using fastcgi on IIS etc, but I'm struggling
to find any suggestions or recommendations on optimising php scripts that
will be running in a fastcgi environment.

Are there dos and don'ts for php in a fastcgi environment, over and above
normal coding practices, or is fastcgi irrelevant at the level of writing
the script?


Denis McMahon

Re: writing php scripts for fastcgi environments

Quoted text here. Click to load it

That's pretty much it.

Re: writing php scripts for fastcgi environments

Quoted text here. Click to load it

I can't speak to the exact implementation of fastcgi, but cgi in general
forks a process to run a shell that executes the program.  Here's some
discussion on fastcgi


You can run php scripts either directly as threads within the memory
space of the web server (usually Apache).  This is the mod_php
implementation and must run on the same machine as the Apache server.

Or you can run the script as a separate process either on the local
machine with the web server or on another machine.

What's your specific concern here?  AFAIK from the above page, you write
a script and it will run via CGI or on a fastcgi implementation

DeeDee, don't press that button!  DeeDee!  NO!  Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]

Re: writing php scripts for fastcgi environments

On 4/1/2011 7:12 PM, Michael Vilain wrote:
Quoted text here. Click to load it

Yes and no.  There are differences between running PHP as a mod and CGI,
mainly in the $_SERVER array.  Scripts running under mod_php will not
necessarily run under fastcgi.  You need to check the doc.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline