I found a useful link that will help you in running a perl and cgi script ( files with extension .pl or .cgi ). It has got step by step explanation of the installation . I was successful in running the cgi in my PC. I hope you  might get lucky too.

For detailed setting of perl :

Visit : http://www.chromicdesign.com/2009/05/setting-up-perl-for-wampp.html

By doing the following easy steps , you will be able to run a cgi script and see its effect .

1. Download ActivePerl  ver 5.10.0.1005 from

http://www.activestate.com/activeperl/

or

http://downloads.activestate.com/ActivePerl/Windows/5.10/ActivePerl-5.10.0.1005-MSWin32-x86-290470.msi

01-active-perl-setup

02-set-directory-to-Cdrive-wamp-bin-Perl-

2. After installing ActivePerl , run the wamp
server.

For testing purpose , I have given some test codes below :

you need to create 2 files inside a new folder under www directory of wamp :

  • cgi_form.html
  • backatcha.cgi

then run the cgi_form.html under wamp server.

Example file :

Create a file named cgi_form.html

<html>
    <head>
        <title></title>
    </head>
    <body>
        <form action="backatcha.cgi" method="GET">
            <p>What is your favorite color?
            <input name="favcolor" /></p>
            <input type=submit value="Send form" />
        </form>
    </body>
</html>

Create a file named backatcha.cgi

#!C:\wamp\bin\Perl\bin\perl.exe

use 5.010;
use CGI;

use strict;
use warnings;

my $q = CGI->new();
say $q->header(), $q->start_html();

say "<h1>Parameters</h1>";

for my $param ($q->param()) {
    my $safe_param = $q->escapeHTML($param);

    say "<p><strong>$safe_param</strong>: ";

    for my $value ($q->param($param)) {
        say $q->escapeHTML($value);
    }
    say '</p>';
}

say $q->end_html();

then , run the wamp server ,

and open the cgi_form.html

(  for example :   http://localhost/cgi/cgi_form.html )

cgi_form
cgi_form
cgi_result
cgi_result


2 Responses to “Setting Perl and CGI in Wamp Server 2.0”  

  1. Lol.. The comments above,, are they spam? BTW.. Thanks for providing the info.. But still im having a problem running cgi in wampserver and vista ultimate…

    • 2 zahidrouf

      what kind of problem ? can u tell me specific so that i can bring out the solution.


Leave a Reply