Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
PHP Server API Differences
Nov 09, 2005 @ 11:39:31

This new post from the SitePoint PHP blog today looks at some of the differences in the APIs that PHP offers.

If you've written code that's had to run under more than one web server environment (even PHP as CGI vs. PHP as module under Apache), you've probably run into headaches like $_SERVER['SCRIPT_FILENAME'] being unavailable—Server APIs (SAPIs) vary.

Some work has been done to provide SAPI-specific functionality to help "understand" parts of the environment but, IMO, the bottom line is there's a minefield if you're writing code that should run under more than one SAPI.

There are a lot of places where this kind of thing pops up, not just in the $_SERVER variables. Of course, it would be nice to have a "magic API" like Harry mentions that would handle it all for you...

tagged:

Link:


Trending Topics: