----- Original Message Edited ----- > From: Mark Eggers <its_toas...@yahoo.com> > To: Tomcat Users List <users@tomcat.apache.org> > Cc: > Sent: Saturday, September 3, 2011 3:53 PM > Subject: Re: CGIServlet - php > > C. Configure web.xml > > I put everything into my web application's web.xml since I didn't want > this capability across all of my applications. I basically copied the section > from $CATALINA_HOME/conf/web.xml and made some changes. Here's what I came > up with. > > <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>/</param-value> > </init-param> > <init-param> > <param-name>executable</param-name> > <param-value>/usr/bin/php-cgi</param-value> > </init-param> > <init-param> > <param-name>passShellEnvironment</param-name> > <param-value>true</param-value> > </init-param> > <load-on-startup>5</load-on-startup> > </servlet> > <servlet-mapping> > <servlet-name>cgi</servlet-name> > <url-pattern>*.php</url-pattern> > </servlet-mapping> > > A few notes are in order. > > 1. In order to not mangle paths, I set the cgiPathPrefix to / > > This means that the search path will be /<WebApp>/ and I can place PHP > files in whatever directory makes sense for the application. >
And this was just plain wrong. Leave the default so that you're a bit more protected. In other words: <init-param> <param-name>cgiPathPrefix</param-name> <param-value>/WEB-INF/cgi</param-value> </init-param> The servlet mapping will then work fine. Directories under WEB-INF/cgi will work as you would expect with the mapping given above. Sigh . . . sorry 'bout the other cgiPathPrefix init-param. . . . . just my two cents. /mde/ --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org