![Avatar of cmuir](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
cmuir
asked on
> How do I setup IIS to run CGI scripts?<
Hi,
First time I have done this - and don't want to cock-it-up.
What do I have to do to setup my IIS (on NT) to run Perl (and other) CGI scripts?
A few queries include -
Do I have to install Perl on the machine for it to run?
Do I have to change the permissions on the .pl file in cgi-bin to make it executable (at the moment it just looks like a txt file)
any help would be appreciated here
Cheers
Charlie
First time I have done this - and don't want to cock-it-up.
What do I have to do to setup my IIS (on NT) to run Perl (and other) CGI scripts?
A few queries include -
Do I have to install Perl on the machine for it to run?
Do I have to change the permissions on the .pl file in cgi-bin to make it executable (at the moment it just looks like a txt file)
any help would be appreciated here
Cheers
Charlie
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
![Avatar of venky75](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
It is irrelevant where PERL is installed. Only don't forget to mention the path to the perl exe file both in the system path and for the IIS site.
![Avatar of cmuir](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
ASKER
If I have it installed on D:\Perl what is the #!/ dir?
(when cgi-bin is at D:\inetpub\wwwroot\cgi-bin )
sorry about this - doh!
(when cgi-bin is at D:\inetpub\wwwroot\cgi-bin
sorry about this - doh!
![Avatar of venky75](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
This doesn't matter really what path u mention in ur .cgi or .pl file. In the IIS, it matters for path to be given to D:/Perl/bin/perl.exe...
![Avatar of maneshr](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
since you are using PERL for CGI scripting, here how you configure and test a PERL Script with Internet Information Server (IIS)
========================== ========== ========
Configuring and Testing a PERL Script with Internet Information Server (IIS)
SUMMARY
The following PERL script can be used to test for the proper installation and execution of CGI
scripts with Internet Information server.
MORE INFORMATION
Create a file with Notepad, and type the following lines of code. Save the file in the scripts
directory as Helloworld.pl.
print "HTTP/1.0 200 OK\n";
print "Content-Type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Hello World</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<H4>Hello World</H4>\n";
print "<P>\n";
print "Your IP Address is $ENV{REMOTE_ADDR}.\n";
print "<P>";
print "<H5>Have a nice day</H5>\n";
print "</BODY>\n";
print "</HTML>\n";
Once you have created the file, you need to configure PERL to run securely with Internet
Information. Perl.exe should not be located in any of the directories accessible by a user with a
browser.
With a script mapping in the registry, you can place the Perl.exe outside of the normal
directory structure a user has access to.
To configure PERL script mapping
1.Start Regedt32.exe and open the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\ CurrentCon trolSet\Se rvices\W3S VC
\Parameters\ScriptMap
2.Click Add Value from the Edit menu.
3.The Value Name is .pl
4.The Data type is REG_SZ.
5.The String value is D:\Perl\perl.exe %s %s
NOTE: The "%s %s" is case sensitive. (e.g. "%S %S" will not work).
6.Restart the WWW service.
Now that the registry has been configured, you can test the PERL script with your browser.
Using the defaults directory structure with IIS, the URL would be the following:
http://<Server Name>/scripts/helloworld.p l?
==========================
Configuring and Testing a PERL Script with Internet Information Server (IIS)
SUMMARY
The following PERL script can be used to test for the proper installation and execution of CGI
scripts with Internet Information server.
MORE INFORMATION
Create a file with Notepad, and type the following lines of code. Save the file in the scripts
directory as Helloworld.pl.
print "HTTP/1.0 200 OK\n";
print "Content-Type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Hello World</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<H4>Hello World</H4>\n";
print "<P>\n";
print "Your IP Address is $ENV{REMOTE_ADDR}.\n";
print "<P>";
print "<H5>Have a nice day</H5>\n";
print "</BODY>\n";
print "</HTML>\n";
Once you have created the file, you need to configure PERL to run securely with Internet
Information. Perl.exe should not be located in any of the directories accessible by a user with a
browser.
With a script mapping in the registry, you can place the Perl.exe outside of the normal
directory structure a user has access to.
To configure PERL script mapping
1.Start Regedt32.exe and open the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\
\Parameters\ScriptMap
2.Click Add Value from the Edit menu.
3.The Value Name is .pl
4.The Data type is REG_SZ.
5.The String value is D:\Perl\perl.exe %s %s
NOTE: The "%s %s" is case sensitive. (e.g. "%S %S" will not work).
6.Restart the WWW service.
Now that the registry has been configured, you can test the PERL script with your browser.
Using the defaults directory structure with IIS, the URL would be the following:
http://<Server Name>/scripts/helloworld.p
![Avatar of cmuir](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
ASKER
Thanks :o)
ASKER