Wednesday, February 3, 2010

Perl on local Wamp Server

Install perl and made these some modification in httpd.conf file of apache web server.

In Directory add these two bold word.

Options Indexes FollowSymLinks Includes ExecCGI


Add these two bold word.

    DirectoryIndex index.php index.php3 index.html index.htm index.cgi index.pl





AddHandler cgi-script .cgi
 AddHandler cgi-script .pl





Now create a folder in c:/wamp/www/  and creating a test.pl file

#!c:/Perl/bin/perl.exe
##
##  printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "${var}=\"${val}\"\n";
}

Open in the browser http://localhost/your_folder/test.pl you see the environment variable of the system.





No comments:

Post a Comment