Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl Apache : Perl script displayed as plain text

Tags:

While configuring with apache and perl cgi scripts, don't know why index.cgi/index.pl are displayed as plain text instead of executing them. When I put http://localhost in browser it displays below code, instead of executing it.

List item
    #!C:/Dwimperl/perl/bin/perl.exe -w

     print "Content-type: text/html\n\n";
        print <<HTML;
        <html>
        <head>
        <title>A perl web page</title>
        </head>
        <body>
        <h3>A hello world form perl</h3>
        </body>

        HTML
        exit;

This are parts of httpd.conf file which I have edited most of the times (after reading various online reference, tutorials)

# This should be changed to whatever you set DocumentRoot to.
<Directory "D:\webserver">

Listen 80
ServerName localhost:80
LoadModule cgi_module modules/mod_cgi.so

# First, we configure the "default" to be a very restrictive set of 
# features.  
<Directory />
    Options FollowSymLinks +ExecCGI
    AllowOverride None
</Directory>

DirectoryIndex index.html index.html.var index.cgi index.pl

AccessFileName .htaccess

# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi .pl

ScriptAlias /cgi-bin/ "C:/Apache/Apache2/cgi-bin/"