Thursday, July 29, 2010

CGI/PERL Configuration in Apache Webserver

APACHE WEB SERVER CGI/PERL CONFIGURATION

1. Install the ApacheWebServer from Apache Site.

Publish Post

2. Install the Perl ActiveState If you are using Windows System.

Configuring Apache WebServer

1. Running Perl Scripts in a CGI directory

Edit httpd.conf file from C:\Program Files\Apache Group\Apache\conf

Find the line

ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/".

It there is a hash mark(#) before the line, remove the hash character and enable it.

2. Running CGI Scripts anyWhere in your domain

1. If you don't want to be restricted to running CGI scripts within the ScriptAlias

directory in your domain, and want CGI scripts to run anywhere in your domain,

add the following line to your "httpd.conf" file.

AddHandler cgi-script .cgi


If you want the .pl extension recognised as a CGI script as well,

simply append the extension to the list, as follows:

AddHandler cgi-script .cgi .pl


Next, search for the line that says " in the file.

It should look something like this:

Options FollowSymLinks

AllowOverride None

Add "+ExecCGI" to the options list. The line now looks like this:

Options FollowSymLinks +ExecCGI

AllowOverride None


Modifying Your CGI Script

Your Perl script will typically contain an initial line of

#!/usr/bin/perl

This tells a Unix-based kernel to look for an interpreter at the path "/usr/bin/perl"

and invoke it to interpret the instructions in the file.

For example, on my Windows box,

I have to change the first line of my Perl scripts to:

#!c:/program files/perl/bin/perl.exe

Note : This is your perl installation directory.

Run the CGI/PERL Script from the Browser


Regards,
Veera
ClimbInc,
Product Support Engineer,
http://www.climb.co.jp

No comments:

Post a Comment