I already configured the Tomcat to run CGI, following some steps from several tutorials, but I do not know what is happening that I cannot run any Perl CGI. The browser just tries to download the code file, it is not showing the compiled output.
I have this simple page (taken from a tutorial)..

<HTML>
<HEAD>
<TITLE>Environment Variables 
   using GET</TITLE>
</HEAD>
<BODY>
<FORM ACTION="./WEB-INF/cgi/exp.cgi" 
   METHOD="GET">
Press submit for a list of environment variables. <BR>

First Name: <input type=
   "text" name="fname" size=
   30><p>
Last Name: <input type="text" 
   name="lname" size=30><p>
<input type="submit">
</form>

<FORM>
</BODY>
</HTML>

...and the simple Perl code ...

#! C:\Perl\bin\perl.exe
print 
   "Content-type: text/plain\n\n";

foreach $var (
   sort keys %ENV) {
   print 
      "$var=\"$ENV{$var}\"\n";
}

@values = split(
   /&/,$ENV{'QUERY_STRING'});
foreach $i (@values) {
   ($varname, $mydata) = split(
      /=/,$i);
   print "$varname = $mydata\n";
}

The Java CLASSPATH...
.;C:\Tomcat\server\lib\servlets-ssi.jar;C:\Tomcat\server\lib\servlets-cgi.jar;C:\Tomcat\webapps\ROOT;C:\Tomcat\server\lib\servlet-api.jar;C:\Tomcat\server\lib\jsp-api.jar;C:\Tomcat\server\lib\el-api.jar

PATH...
C:\Perl\site\bin;C:\Perl\bin;C:\Program Files\Java\jdk1.6.0_02\bin

'''''''''''''''Any help is appreciated''''''''''''

Recommended Answers

All 3 Replies

I understand that you say you have setup Tomcat to run CGI scripts, but it appears you did not set it up correctly. Since this is really a Tomcat configuration issues maybe asking on a Tomcat forum will get you the info you need.

Does Tomcat use the ubiquitous cgi-bin? Are your scripts in the cgi-bin? Have you tried .cgi and .pl?

Hi,

take a look at this

kath.

commented: good post +2

Hi,

take a look at this

kath.

Thanks!! :icon_smile: That helped me to solve the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.