Skip to main content.
home | support | download

Back to List Archive

Re: Got it working on Windows IIS

From: Marko Faldix <marko.faldix(at)not-real.mplusr.de>
Date: Fri Jan 16 2004 - 15:37:04 GMT
> On Fri, Jan 16, 2004 at 02:06:43AM -0800, Marko Faldix wrote:
>
> > I could suggest the following:
> >
> > On both, Apache and IIS  (don't know for PWS or other) there is server
> > variable called PATH_TRANSLATED set as full file system path to called
cgi
> > script, thus in my case it is set
> > PATH_TRANSLATED = c:\home\mydir\swish\swish.cgi
> > when calling http://localhost/swish/swish.cgi
>
> That's incorrect, according to the standard.  PATH_TRANSLATED is the
> PATH_INFO translated.  PATH_INFO is the *extra* info added to the end of
> a URL after the program name.
>
> What you likely want it SCRIPT_FILENAME.
>
>
> See:
> http://hoohoo.ncsa.uiuc.edu/cgi/env.html


Read it, thanks for this link. What is wrong with PATH_TRANSLATED?


> You could try this on IIS:
>
> moseley@bumby:~/apache$ cat test.cgi
> #!/usr/bin/perl
> print "content-type: text/plain\n\n";
> print "$_ : $ENV{$_}\n" for sort keys %ENV;
>
> moseley(at)not-real.bumby:~/apache$ GET http://localhost/apache/test.cgi | egrep
'(PATH_|SCRIPT_FILENAME)'
> SCRIPT_FILENAME : /var/www/apache/test.cgi
>
> moseley(at)not-real.bumby:~/apache$ GET http://localhost/apache/test.cgi/ | egrep
'(PATH_|SCRIPT_FILENAME)'
> PATH_INFO : /
> PATH_TRANSLATED : /var/www/
> SCRIPT_FILENAME : /var/www/apache/test.cgi
>
> moseley(at)not-real.bumby:~/apache$ GET http://localhost/apache/test.cgi/extra/path |
egrep '(PATH_|SCRIPT_FILENAME)'
> PATH_INFO : /extra/path
> PATH_TRANSLATED : /var/www/extra/path
> SCRIPT_FILENAME : /var/www/apache/test.cgi
>
> Can you report back what IIS returns?

Yes, here reduced to what we need. I put it into
C:\home\mydir\swish\test.cgi and called http://localhost/swish/test.cgi
which returns

GATEWAY_INTERFACE : CGI/1.1
HTTP_HOST : localhost
OS : Windows_NT
PATH : C:\Perl\bin\;C:\Programme\Swish-E;C:\Programme\SWISH-E\lib\swish-e;
..
PATH_INFO : /swish/test.cgi
PATH_TRANSLATED : C:\home\mydir\swish\test.cgi
REQUEST_METHOD : GET
SCRIPT_NAME : /swish/test.cgi
SERVER_NAME : localhost
SERVER_SOFTWARE : Microsoft-IIS/5.0


IIS does not have variable SCRIPT_FILENAME!

If I had the path to the directory where the called swish.cgi is, I could
take this directory as my default to look for configuration
file, appreciating same code for both Apache and IIS. So PATH_TRANSLATED or
SCRIPT_NAME seems to be useful.

Would you suggest to prefer SCRIPT_NAME?


Marko Faldix
Received on Fri Jan 16 15:39:27 2004