in reply to Re: IIS6 + Perl CGI: finding locations on disk
in thread IIS6 + Perl CGI: finding locations on disk

Hello - and thank you for the hints. Unfortunately script_name or getcwd return the location of the script in the filesystem (let's say c:\test\test.pl). This can be mapped in to various addresses using the Virtual Folder option of IIS. If my site is at d:\webroot and test is aliased as http://localhost/somename, I can find my location as c:\test\test.pl or /somename/test.pl but have no hints on the existence of d:\webroot
  • Comment on Re^2: IIS6 + Perl CGI: finding locations on disk

Replies are listed 'Best First'.
Re^3: IIS6 + Perl CGI: finding locations on disk
by ikegami (Patriarch) on Sep 13, 2008 at 16:55 UTC

    Like I already said, my server provides the document root in $ENV{DOCUMENT_ROOT}. Check your server's documentation or just dump the environment variables

    #!/usr/bin/perl use strict; use warnings; use List::Util qw( max ); print("Content-Type: text/plain\n\n"); my $max_size = max map length, keys %ENV; my $format = "%-" . ($max_size+1) . "s %s\n"; for (sort keys %ENV) { printf($format, "$_:", $ENV{$_}); }
      I have tried to print all environment variables, and document_root is simply not there. Some googling revealed IIS6 does not export this variable at all for CGI applications. I will check if ISAPI is treated differently.
Re^3: IIS6 + Perl CGI: finding locations on disk
by Anonymous Monk on Sep 14, 2008 at 05:31 UTC
    Then IIS is broken. For url
    http://server.port/this/is/all/SCRIPT_NAME?que=ry
    SCRIPT_NAME =/this/is/all/SCRIPT_NAME

    The documentation ( IIS Server Variables ) confirms this.