Configure PERL/CGI Script Mapping for IIS 5.0 and 5.1

Contents hide 1 Configure PERL/CGI Script Mapping for IIS 5.0 and 5.1 2 OPen ‘run’, type ‘inetmgr’ 3 (note that – %s %s these are case sensitive, and once...

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

I can reach at : durgacharanojha@yahoo.co.in
Categories
Windows

I am a proud Indian, proud father, a blogger, Being in a profession as System administrator, my passion is troubleshooting computer issues, I do like sharing solutions through blogging making videos of solving issues.
One Comment
  • hdaf
    3 May 2012 at 12:05 pm
    Leave a Reply

    there is a wrong in the code.
    Please correct the code in line 3. to this
    print<HTTP/1.0 200 OK …………..

    1. $url = “http://$ENV{SERVER_NAME}$ENV{URL}”;
    2. $ip = “$ENV{REMOTE_ADDR}”;
    3. print Content-Type: text/html

    Hello World!

    You have reached $url

    Your IP Address is $ip

    Have a nice day!

    ENDOFTEXT
    exit(0);

  • Leave a Reply

    *

    *

    RELATED BY