Click to See Complete Forum and Search --> : CGI (Perl) Script not executing...?


SimonWray
09-01-2006, 06:48 AM
Hi

I'm trying to execute a cgi-script from an html doc. I'm running Apache on a WinTel box.

The script is simply:

#!c:/program files/perl/perl.exe
## test -- test CGI program to display a simple message
##
use strict;
print "Content-type: text/html\n\n";
print "<HTML><BODY><H3>Test CGI Script</H3><UL>";
print "Hello World!\n";
print "</UL></BODY></HTML>";

This is located on my local m/c here;
http://ws000665/cgi-bin/test.cgi

The page I am trying to get the script's text to display on his here;
http://ws000665/database_diagrams.htm

And I have this html to try and run it;

<p>
<!--This is the Main Content -->
Test
<!--#exec cgi="..\cgi-bin\test.cgi"-->
<br />
</p>

My html page is located in the \Apache2.2\htdocs directory, and the cgi is located in \Apache\cgi-bin.

I can execute the cgi by entering it's location direct into my browser. So i'm thinking that my syntax/method of execution is incorrect. I've tried switching from backslash to slash or putting in the absolute path, but to no effect.

The relevant section of my Apache Conf is;

(Note, this AddHandler is commented out, but I don't think I need it bcz I'm using a ScriptAliass...?)
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
...
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
...
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
Options FollowSymLinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Location /cgi-bin>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options +ExecCGI +Includes
PerlOptions +ParseHeaders
</Location>

Any suggetions welcome!
Thanks
Simon

SimonWray
09-06-2006, 05:29 AM
Bump. Anyone?

CyCo
09-06-2006, 06:15 PM
Runs fine on my machine, although I changed the path...<p>
<!--This is the Main Content -->
Test
<!--#exec cgi="/cgi-bin/test.cgi"-->
<br />
</p>...and changed my page extension to .shtml, since I have configured the server to "NOT" parse .htm or .html files as .shtml.