CGI with Tomcat 7

Software Requirements (used for this post)

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

  1. Download Tomcat. Install or unzip it to some directory.
  2. Modify <TOMCAT_HOME>\conf\web.xml to uncomment the cgi servlet and its mapping
    and add an 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