Here are the headers I use under IIS4:
if ($ENV{'PERLXS'} eq 'PerlIS')
{
print $ENV{'SERVER_PROTOCOL'}, " 200 OK\n";
if ($ENV{'SERVER_PROTOCOL'} ne "HTTP/0.9")
You've created your ScriptMap registry settings, and they still don't work, right? Right. They don't. Under IIS4, you specify the interpreter association differently:
This is where you say that .pl files are handled by C:\perl\bin\perl.exe. I've got the following command:
C:\perl\bin\perl.exe %sOthers have suggested
C:\perl\bin\perl.exe %s %sIf there's a reason for the second argument, I'd like to know what it is....
You should also mark this entry as being a Script interpreter. This means that your directory with all your .pl scripts in can be marked as having Script permission, not Execute permission; that way, it's safer.
It's a good idea to select the option to make IIS4 verify that the .pl file exists before invoking Perl (I'm kinda scared that it doesn't, anyway....).
A side note: you shouldn't have the perl.exe file visible in any directory which has Execute permission, as far as the web server is concerned; to do so means that anyone can run their own scripts on your machine.
$var = `$cmd`; # backticksor
open(PIPE, "$cmd|"); # popen @data =;
You may also have noticed that the scripts run fine from the command-line, but not when invoked by the web server.
The problem here is that IIS4 runs processes without a console, and for some reason, this prevents Perl from redirecting I/O. You'll probably find that the external commands are running, but Perl is failing to receive output from them.
Under IIS2 and IIS3, the fix for this was quite simple: add the registry setting:
and set it to one. Naturally, since we've learned about this one, Microsoft have changed it. Now:
In their wisdom, Microsoft moved all the registry settings for IIS4 out of the registry into the metabase. Uh-huh. So how'd you change it? Well:
adsutil.vbs SET W3SVC/1/CreateCGIWithNewConsole 1It'll say that CScript isn't set up to handle this. That's ok.
$| = 1;(this works on the currently-selected output filehandle, so it'll only work if you haven't select()ed any other filehandle)
Personally, I also find that it's best to redirect stderr to a file in C:\temp, right at the start of the script. At least, then when errors occur, I've got a reasonable chance of seeing any error messages. If anyone knows how to see stderr output with IIS4 normally, I'd like to know about it.
system("\path\to\script.pl")
You'll find that Notepad (or whatever) will start up in the background. Not nice.
On NT, always invoke other Perl scripts using:
system("c:\perl\bin\perl.exe \path\to\script.pl")
(of course, if you can eval the script instead, that's better)
I also don't know why any of this console messing-about is necessary. I'd really like someone to explain to me both the no-console thing to begin with, and why Perl doesn't like it.
In passing, I'd like to mention that in moving a system from one machine with IIS3 to another with IIS4, sorting out the console issue took half a week's work. In constrast, making the necessary changes to the 50 files containing 10,000 lines of Perl took about half an hour.