You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Joel Parramore <pa...@homes.com> on 2005/03/16 14:27:44 UTC

[users@httpd] SSI "exec cmd=" vis-à-vis Apache+Tomcat/mod_jk issue

 

Hello folks,

 

I’m working on porting some legacy code into Java, piecewise.  The legacy
code has a script (which I have to keep for now) that generates a header and
footer separately for a page using SSIs for a given HTML page request, e.g.,
a page on the server would look like 

 

<!--#exec cmd=”/path/to/headerfooterscript --showheader”-->

…

(some HTML or other SSI directives here)

…

<!--#exec cmd=”/path/to/headerfooterscript --showfooter”-->

 

Instead of HTML files now, I have JSPs.  I have an Apache (2.0.53)
installation handing off requests to a Tomcat (5.5.7) server via mod_jk
(1.2.8).  The output from those requests has the header/footer includes in
it, after which Apache is configured to process the output for the SSIs
(using “SetOutputFilter INCLUDES” in the configuration) and run those.
Apache parses the output for SSIs but fails to run the “headerfooterscript”,
returning this message in the log:

 

     (2)No such file or directory: change of working directory failed

 

The directory exists, the script exists, it’s executable, the Apache user
has permissions to run it, but I get this message.  Doing a little
debugging, I see that the value that Apache has for the working directory is
empty.

 

Now, one odd thing is that doing this works if I use “#exec cgi” or
“#include virtual” commands in the JSP output instead of “#exec cgi” (using
either of those is undesirable for other reasons right now), it works --- I
get the output from a test script or file included in the output from the
JSP.  

 

The other odd thing is that if I write a plain CGI script (Perl in this
case) to return as output the header/footer includes using the “#exec cmd”
syntax, it also works --- no “(2)No such file or directory: change of
working directory failed” messages.  Debugging shows that the value for the
working directory is being set correctly for all the working cases.

 

So it appears that it might be a bug vis-à-vis Apache and mod_jk in some
fashion, either before the request is handed off, or after it comes back.  I
should note that the original issue was spotted under Solaris 8, but it also
happens under Solaris 9.  Also, I don’t have any third-party modules
compiled either.  I haven’t tested Apache under Linux (wouldn’t be the
production environment anyway) to see if it also happens there.

 

If this rings a bell with anyone and you have a solution (or viable
suggestions), I’d be happy to hear it.  If it seems like a bug, I’ll put a
bug report in at http://issues.apache.org/bugzilla/ (I’ve been searching
there but haven’t found any similar-sounding issues yet).

 

Regards,

Joel Parramore

 


RE: [users@httpd] SSI "exec cmd=" vis-à-vis Apache+Tomcat/mod_jk issue

Posted by Joel Parramore <pa...@homes.com>.
> I don't know the answer to your problem, but a couple
> gueses/suggestions:  Could it be an issue with passing arguments?
> Have you tried replacing your exec cmd with
> /path/to/footerheaderscript-showheader (another script that simply
> executes your script with the correct arguments)?
>

As using the arguments does work for the plain CGI script, I don't know why
it wouldn't work for the output from the JSP, but I'll try it ---thanks.

I have tried putting the "exec cmd" directive into an HTML page, including
an SSI directive in the JSP output for the HTML page instead of the "exec
cmd", and Apache will process the HTML file for the "exec cmd" and run it
properly.  However, that's another workaround that I want to avoid if I can.

Regards,
Joel



> -----Original Message-----
> From: Joshua Slive [mailto:jslive@gmail.com]
> Sent: Wednesday, March 16, 2005 1:30 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] SSI "exec cmd=" vis-à-vis Apache+Tomcat/mod_jk
> i ssue
> 
> On Wed, 16 Mar 2005 08:27:44 -0500, Joel Parramore <pa...@homes.com>
> wrote:
> 
> > <!--#exec cmd="/path/to/headerfooterscript --showheader"à
> 
> >      (2)No such file or directory: change of working directory failed
> 
> > Now, one odd thing is that doing this works if I use "#exec cgi" or
> > "#include virtual" commands in the JSP output instead of "#exec cgi"
> (using
> > either of those is undesirable for other reasons right now), it works --
> - I
> > get the output from a test script or file included in the output from
> the
> > JSP.
> >
> >
> >
> > The other odd thing is that if I write a plain CGI script (Perl in this
> > case) to return as output the header/footer includes using the "#exec
> cmd"
> > syntax, it also works --- no "(2)No such file or directory: change of
> > working directory failed" messages.  Debugging shows that the value for
> the
> > working directory is being set correctly for all the working cases.
> 
> I don't know the answer to your problem, but a couple
> gueses/suggestions:  Could it be an issue with passing arguments?
> Have you tried replacing your exec cmd with
> /path/to/footerheaderscript-showheader (another script that simply
> executes your script with the correct arguments)?
> 
> Joshua.
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] SSI "exec cmd=" vis-à-vis Apache+Tomcat/mod_jk i ssue

Posted by Joshua Slive <js...@gmail.com>.
On Wed, 16 Mar 2005 08:27:44 -0500, Joel Parramore <pa...@homes.com> wrote:

> <!--#exec cmd="/path/to/headerfooterscript --showheader"à 

>      (2)No such file or directory: change of working directory failed 

> Now, one odd thing is that doing this works if I use "#exec cgi" or
> "#include virtual" commands in the JSP output instead of "#exec cgi" (using
> either of those is undesirable for other reasons right now), it works --- I
> get the output from a test script or file included in the output from the
> JSP.  
> 
>   
> 
> The other odd thing is that if I write a plain CGI script (Perl in this
> case) to return as output the header/footer includes using the "#exec cmd"
> syntax, it also works --- no "(2)No such file or directory: change of
> working directory failed" messages.  Debugging shows that the value for the
> working directory is being set correctly for all the working cases. 

I don't know the answer to your problem, but a couple
gueses/suggestions:  Could it be an issue with passing arguments? 
Have you tried replacing your exec cmd with
/path/to/footerheaderscript-showheader (another script that simply
executes your script with the correct arguments)?

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org