Apache » HTTPD
How do I configure Apache HTTP Server to work with PERL-CGI on Windows?
I assume that you already have Apache HTTP Server and PERL installed. If not, you may download them from:
- Apache HTTP Server from http://httpd.apache.org/
- ActivePERL from http://www.activestate.com/Products/activeperl/
Install both, the HTTP Server and the PERL.
Now go to the folder where the HTTP Server has been installed.
Default location (assuming that you've version 2.2) is "C:\Program Files\Apache Software Foundation\Apache2.2". Look for the file "conf\httpd.conf".
Within the file, search for a line that reads:
#AddHandler server-parsed .cgi
Modify the line to as follows:
AddHandler server-parsed .cgi .pl
(Notice that I've removed the initial #-symbol.)
I further assume that you have a directory, say, C:\Personal\PERL where you have kept all your PERL / CGI scripts, and that PERL is installed in C:\Perl folder.
Create a file "conf\extras\perl.conf" for Apache configuration with the following content:
Alias /perl C:/Personal/PERL
<Directory "C:/Personal/PERL">
Options Indexes Includes ExecCGI
AllowOverride None
Order allow, deny
Allow from all
</Directory>
ExecCGI is the key option that is enabled - it enables execution of CGI programs.
Now, modify the "conf\httpd.conf" file to add the following line, preferably at the end:
Include conf/extras/perl.conf
Now, you are ready to work with PERL-CGI on Apache.
You may test it by creating a file, say, "HelloWorld.cgi" in the folder "C:\Personal\PERL" with the following content:
#! C:/Perl/bin/perl.exe
print "Content-Type: text/plain\r\n\r\n";
print "Hello, World!";
Browse to http://localhost/perl or whatever be the port at which Apache Server is configured.
Oh! Yes. You may need to restart the server after making all changes to the "conf\httpd.conf" file.
Last update: 2008-06-25 23:55
Author: Edujini Labs Pvt Ltd
Revision: 1.0
Print this record
Send to a friend
Show this as PDF file
Export as XML-File
You can comment on this entry
Comment of women handbags (2010-08-02 23:37:03):
sports bags Boots Before April Fools' Day The New women handbags for Summer