Connecting Tech Pros Worldwide Forums | Help | Site Map

Site for tips on server neutrality of PHP code?

Preston Crawford
Guest
 
Posts: n/a
#1: Jul 17 '05
I'm working on a site that's being developed on Apache/Linux and going to
be hosted on IIS/Windows. Anyone know of a site with good tips on possible
pitfalls, things to look for. Typical things I'll be looking to do that I
can see tripping me up include file upload, email, etc.

I'll be googling until then, but I thought I'd ask as well.

Preston

Pedro Graca
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Site for tips on server neutrality of PHP code?


Preston Crawford wrote:[color=blue]
> I'm working on a site that's being developed on Apache/Linux and going to
> be hosted on IIS/Windows. Anyone know of a site with good tips on possible
> pitfalls, things to look for. Typical things I'll be looking to do that I
> can see tripping me up include file upload, email, etc.[/color]

The super-global array $_SERVER does not have the same keys.
If you rely on $_SERVER['DOCUMENT_ROOT'], $_SERVER['SCRIPT_FILENAME'] (IIRC),
maybe others (I can check tomorrow) you'll have a nasty surprise when
you switch servers.
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
lawrence
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Site for tips on server neutrality of PHP code?


Pedro Graca <hexkid@hotpop.com> wrote in message news:<c3vqnc$2cqo42$4@ID-203069.news.uni-berlin.de>...[color=blue]
> Preston Crawford wrote:[color=green]
> > I'm working on a site that's being developed on Apache/Linux and going to
> > be hosted on IIS/Windows. Anyone know of a site with good tips on possible
> > pitfalls, things to look for. Typical things I'll be looking to do that I
> > can see tripping me up include file upload, email, etc.[/color]
>
> The super-global array $_SERVER does not have the same keys.
> If you rely on $_SERVER['DOCUMENT_ROOT'], $_SERVER['SCRIPT_FILENAME'] (IIRC),
> maybe others (I can check tomorrow) you'll have a nasty surprise when
> you switch servers.[/color]

I assume the same is true of $HTTP_SERVER_VARS? (I work on a project
that stays backwards compatible with PHP 4.0.6).
Pedro Graca
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Site for tips on server neutrality of PHP code?


lawrence wrote:[color=blue]
> Pedro Graca <hexkid@hotpop.com> wrote in message news:<c3vqnc$2cqo42$4@ID-203069.news.uni-berlin.de>...[color=green]
>> The super-global array $_SERVER does not have the same keys.
>> If you rely on $_SERVER['DOCUMENT_ROOT'], $_SERVER['SCRIPT_FILENAME'] (IIRC),
>> maybe others (I can check tomorrow) you'll have a nasty surprise when
>> you switch servers.[/color]
>
> I assume the same is true of $HTTP_SERVER_VARS? (I work on a project
> that stays backwards compatible with PHP 4.0.6).[/color]

Yes, just tested it.

I've just run print_r($_SERVER) on both IIS and Apache.
As it is, what I said before is wrong (sorry everyone), both
[DOCUMENT_ROOT] and [SCRIPT_FILENAME] are available under both servers.


For my configuration this is what I found (unless I messed up again):

$_SERVER keys available under both servers
[DOCUMENT_ROOT]
[HTTP_*]
[PHP_SELF]
[QUERY_STRING]
[REMOTE_ADDR]
[REQUEST_METHOD]
[REQUEST_URI]
[SCRIPT_FILENAME]
[SCRIPT_NAME]
[SERVER_NAME]
[SERVER_PORT]
[SERVER_PROTOCOL]
[SERVER_SOFTWARE]

$_SERVER keys available under Apache but NOT IIS
[COMSPEC]
[GATEWAY_INTERFACE]
[PATHEXT]
[PATH]
[REMOTE_PORT]
[SERVER_ADDR]
[SERVER_ADMIN]
[SERVER_SIGNATURE]
[SystemRoot]
[WINDIR]

$_SERVER keys available under IIS but NOT Apache
[ALL_HTTP]
[APPL_MD_PATH]
[APPL_PHYSICAL_PATH]
[AUTH_TYPE]
[AUTH_USER]
[CONTENT_LENGTH]
[HTTPS]
[INSTANCE_ID]
[INSTANCE_META_PATH]
[LOGON_USER]
[ORIG_PATH_INFO]
[ORIG_PATH_TRANSLATED]
[PATH_INFO]
[PATH_TRANSLATED]
[REMOTE_HOST]
[REMOTE_USER]
[url]

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Justin Koivisto
Guest
 
Posts: n/a
#5: Jul 17 '05

re: Site for tips on server neutrality of PHP code?


Pedro Graca wrote:[color=blue]
> Yes, just tested it.
>
> I've just run print_r($_SERVER) on both IIS and Apache.
> As it is, what I said before is wrong (sorry everyone), both
> [DOCUMENT_ROOT] and [SCRIPT_FILENAME] are available under both servers.[/color]

That data is slightly misleading... I have a more comprehensive look at
PHP 4.3.4 on Apache 1.3.29 and PHP 4.3.3 on IIS 5.1 that I just created
for another project that I've been working on.

http://www.koivi.com/apache-iis-php-server-array.html

--
Justin Koivisto - spam@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
SEO Competition League: http://seo.koivi.com/
Closed Thread