| |||||||||||
| |||||||||||
Perl CGI scripts with SSI in Tomcat Posted by carletto (carletto), 2 March 2006 ![]() Installed SSI and CGI as written in the How-tos. For CGI : <servlet> <servlet-name>cgi</servlet-name> <servletclass>org.apache.catalina.servlets.CGIServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>6</param-value> </init-param> <init-param> <param-name>cgiPathPrefix</param-name> <param-value>WEB-INF/cgi-bin</param-value> </init-param> <load-on-startup>5</load-on-startup> </servlet> <servlet-mapping> <servlet-name>cgi</servlet-name> <url-pattern>/cgi/*</url-pattern> </servlet-mapping> Then I wrote a "index.shtml" file: <html> <!--#echo var="DATE_LOCAL" --> <!--#exec cgi="ciao.cgi" --> <!--#exec cgi="cgi/ciao.cgi" --> <!--#echo var="DATE_LOCAL" --> </html> and a "ciao.cgi" file (in /webapps/ciao/ and in /webapps/ciao/WEB.INF/cgi/): #!c:/Perl/bin/perl -wT print "Content-type: text/html\n\n"; print "CIAO"; After writing in Explorer "http://localhost:80/ciao" I get: Wednesday, 01-Mar-2006 17:46:50 CET #!c:/Perl/bin/perl -wT print "Content-type: text/html\n\n"; print "CIAO"; [an error occurred while processing this directive] Wednesday, 01-Mar-2006 17:46:50 CET and in the log : Serving buffered resource '/index.shtml' 2006-03-01 17:46:50 StandardContext[/ciao]ssi: SSIProcessor.process -- processing command: echo 2006-03-01 17:46:50 StandardContext[/ciao]ssi: SSIProcessor.process -- processing command: exec 2006-03-01 17:46:50 StandardContext[/ciao]ssi: SSIServletExternalResolver.getServletContextAndPath( ciao.cgi, true) 2006-03-01 17:46:50 StandardContext[/ciao]ssi: SSIProcessor.process -- processing command: exec 2006-03-01 17:46:50 StandardContext[/ciao]ssi: SSIServletExternalResolver.getServletContextAndPath( cgi/ciao.cgi, true) 2006-03-01 17:46:50 StandardContext[/ciao]cgi: findCGI: path=/index.shtml, J:\jakarta-tomcat-5.0.30\webapps\ciao\WEB-INF/cgi-bin 2006-03-01 17:46:50 StandardContext[/ciao]cgi: findCGI: currentLoc=J:\jakarta-tomcat-5.0.30\webapps\ciao\WEB-INF\cgi-bin 2006-03-01 17:46:50 StandardContext[/ciao]cgi: findCGI: currentLoc=J:\jakarta-tomcat-5.0.30\webapps\ciao\WEB-INF\cgi-bin 2006-03-01 17:46:50 StandardContext[/ciao]ssi: #include--Couldn't include file: cgi/ciao.cgi java.io.IOException: Couldn't find file: /cgi/ciao.cgi at org.apache.catalina.ssi.SSIServletExternalResolver.getFileText(SSIServletExternalResolver.java:391) Do you have an idea why it does not execute the script ![]() Thanks Carlo Posted by admin (Graham Ellis), 3 March 2006 Why are you trying to mix up SSIs and Perl code via CGIs? If you want to use SSIs ... and execs within them ... then the program you "exec" wouldn't be to the Common Gateway Interface (CGI) standard. Now I don't thinks that's the cause of the problem that you've reported, but I do fear that if I halp you sort this one out I would be leading you down a blind alley.Suggestion - use JUST an SSI, or JUST a Perl based CGI program and the setup should be much easier. If you have a substantial amount of HTML with just a little information you want to change in a Perl program, then write a Perl program that reads in a file of HTML and substitutes in it where appropriate. Posted by admin (Graham Ellis), 3 March 2006 By the way - we have fully worked examples of using Tomcat to serve SSI pages here on our web site and to serve CGI written in Perl here on the siteThis page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |