Return-Path: Delivered-To: apmail-perl-embperl-archive@www.apache.org Received: (qmail 32067 invoked from network); 2 Jul 2004 23:49:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Jul 2004 23:49:20 -0000 Received: (qmail 99328 invoked by uid 500); 2 Jul 2004 23:49:32 -0000 Delivered-To: apmail-perl-embperl-archive@perl.apache.org Received: (qmail 99036 invoked by uid 500); 2 Jul 2004 23:49:25 -0000 Mailing-List: contact embperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list embperl@perl.apache.org Received: (qmail 98829 invoked by uid 99); 2 Jul 2004 23:49:19 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.55.68.150] (HELO orbsoft.com) (209.55.68.150) by apache.org (qpsmtpd/0.27.1) with ESMTP; Fri, 02 Jul 2004 16:49:15 -0700 Received: from office (office.orbsoft.com [24.205.67.142]) by orbsoft.com (8.11.6/8.11.2) with ESMTP id i62N9Lb01074 for ; Fri, 2 Jul 2004 16:09:21 -0700 From: "Maurice McCabe" To: Subject: IIS PATH_TRANSLATED fix Date: Fri, 2 Jul 2004 16:48:46 -0700 Message-ID: <044e01c4608f$1d9f8580$0e00a8c0@orbsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 In-Reply-To: <043801c459b0$5ac01370$020d0b0a@wingr2> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Importance: Normal X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I am installing on a shared Windows Server running IIS and want to be able to run embpcgi.pl as a regular CGI script (no file extension mapping is available, since not supported in this ISP's shared environment). By default, in CGI mode, IIS does not generate the correct value for PATH_TRANSLATED, so I created a fix that gets around the problem that I would like to share. Adding the following to your embpcgi.pl will allow you to run on IIS using a URL like: http://www.mycompany.com/cgi-bin/embpcgi.pl/myembperlapplication/index.h tm (This fix still behaves correctly when using file extension mapping allowing you to run in either mode) BEGIN { if ($^O eq "MSWin32" && $#ARGV == -1) { my $SCRIPT_FILENAME=$0; my ($path_info) = $ENV{PATH_INFO} =~ /^$ENV{SCRIPT_NAME}(.*)$/; my $SCRIPT_NAME = $ENV{SCRIPT_NAME}; $SCRIPT_NAME =~ s/\//\\\\/g; my ($document_root) = $SCRIPT_FILENAME =~ /^(.*)$SCRIPT_NAME.*/; $ENV{PATH_TRANSLATED}=$document_root . $path_info; } } This fix is not restricted for use with Embperl or even with Perl (may involve more coding if rewritten in another language). It should work for any CGI application running on IIS that uses PATH_TRANSLATED. Hope this helps some folks out there that have been looking for this. BTW: With this fix, I can confirm that Embperl will run in a shared Windows environment running IIS and Perl. (Requires only FTP and setting of @INC to install. Must have precompiled non-modperl version of Embperl for windows available from Randy Kobes) Maurice --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org For additional commands, e-mail: embperl-help@perl.apache.org