Sunday, December 11, 2011
In this post I am do some CGI testing with some scripts. This is done in a Linux x86-64 bit environment.
Steps:
1- edit the web.xml file in $CATALINA_HOME/conf directory. Mine is
/home/oracle/tomcat7023/conf. I added the "passShellEnvironment" environment line in the A section below.
A-
<servlet>
<servlet-name>cgi</servlet-name>
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>cgiPathPrefix</param-name>
<param-value>WEB-INF/cgi</param-value>
</init-param>
<param-name>passShellEnvironment</param-name>
<param-value>true</param-value>
<load-on-startup>5</load-on-startup>
</servlet>
B-
<!-- The mapping for the CGI Gateway servlet -->
<servlet-mapping>
<servlet-name>cgi</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>
2- Now edit the context.xml also in $CATALINA_HOME/conf as:
At the beginning of the context
<Context privileged="true">
3- mkdir $CATALINA_HOME/webapps/ROOT/WEB-INF/cgi
4- copy all your cgi stuff into abpve directory. Mine looks like:
total 28
drwxr-xr-x 2 oracle dba 4096 Dec 9 09:58 .
drwxr-xr-x 3 oracle dba 4096 Dec 7 11:19 ..
-rwxr-xr-x 1 oracle dba 470 Dec 9 09:51 ml1.sh
-rwxr-xr-x 1 oracle dba 622 Dec 7 12:28 ml.sh
-rwxr-xr-x 1 oracle dba 470 Dec 7 12:14 m.sh
-rw-r--r-- 1 oracle dba 451 Dec 9 09:58 m.sql
-rwxr-xr-x 1 oracle dba 78 Dec 7 11:21 test.cgi
5- Restart the tomcat. Make sure that it completely goes down by ps -ef and netstat -an .
6- Test the scripts. Below are the screen shots
Scripts are pasted here - http://bit.ly/rV0j07
Hope this Helps ..
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment