Configure PERL/CGI Script Mapping for IIS 5.0 and 5.1
OPen ‘run’, type ‘inetmgr’
From IIS, right-click a Web site that you want to enable CGI for, and then click Properties.
Click the Virtual Directory tab.
Click Configuration.
Click Add on ‘Application Mappings’ tab.
Type the following for Executable
Executable – Browse the path to the perl.exe, for mine its C:\perl\bin\perl.exe %s %s
(note that – %s %s these are case sensitive, and once you browse to perl.exe then just type %s %s)
Extension – .cgi
Verbs limit to – GET,HEAD,POST,TRACE
Script engine – checked
Check that file exists -checked
click ok
sample cgi program to print ‘Hello World’
-#! /usr/bin/perl
-print “Content-type: text/html\n\n”;
-print ”
Hello World!”;
-print ”
\n”;
copy this in a note pad and same it as helloworld.cgi
Put it inside your virtual directory and browse. You will get the output as Hello World.
If any error just restart the IIS with command iisreset by typing in run.
For Perl
OPen ‘run’, type ‘inetmgr’
From IIS, right-click a Web site that you want to enable PERL for, and then click Properties.
Click the Virtual Directory tab.
Click Configuration.
Click Add on ‘Application Mappings’ tab.
Type the following for Executable
Executable – Browse the path to the perl.exe, for mine its C:\perl\bin\perl.exe %s %s
(note that – %s %s these are case sensitive, and once you browse to perl.exe then just type %s %s)
Extension – .pl
Verbs limit to – GET,HEAD,POST,TRACE
Script engine – checked
Check that file exists -checked
click ok
sample perl program to print ‘Hello World!’
$url = “http://$ENV{SERVER_NAME}$ENV{URL}”;
$ip = “$ENV{REMOTE_ADDR}”;
print HTTP/1.0 200 OK
Content-Type: text/html
Hello World!
You have reached $url
Your IP Address is $ip
Have a nice day!
ENDOFTEXT
exit(0);
copy this in a note pad and same it as helloworld.pl
Put it inside your virtual directory and browse. You will get the output as Hello World!.
If any error just restart the IIS with command iisreset by typing in run.
Thanks
Durga
there is a wrong in the code. HTTP/1.0 200 OK …………..
Please correct the code in line 3. to this
print<
1. $url = “http://$ENV{SERVER_NAME}$ENV{URL}”; Content-Type: text/html
2. $ip = “$ENV{REMOTE_ADDR}”;
3. print
Hello World!
You have reached $url
Your IP Address is $ip
Have a nice day!
ENDOFTEXT
exit(0);