Java, PERL, Software Development, Tomcat

CGI with Tomcat 7

We can run CGI scripts in Tomcat. This post is about using Tomcat to run a CGI script written in PERL.

Software Requirements (used for this post)

  • Apache Tomcat 7.0.11
  • JDK 1.6 update 21
  • Perl 5.12 (ActivePerl-5.12.2.1202)
  • Windows XP SP3

Install and Configure

  1. Download Tomcat. Install or unzip it to some directory.
  2. Modify <TOMCAT_HOME>\conf\web.xml to uncomment the GCI servlet and its mapping and add a servlet parameter passShellEnvironment and set it to “true”
  3. Modify <TOMCAT_HOME>\conf\context.xml to add a property on <Context>:
  4. Create a cgi folder under <TOMCAT_HOME>\webapps\ROOT\WEB-INF\
  5. Install Perl
  6. Create a CGI script and place it under <TOMCAT_HOME>\webapps\ROOT\WEB-INF\cgi\
  7. Start Tomcat and access the URL:http://localhost:8080/cgi-bin/test1.cgi
    CGI with Tomcat 7

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like