Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Apache Registry with Server Side Includes

by moritz (Cardinal)
on Jan 01, 2012 at 19:54 UTC ( #945805=note: print w/ replies, xml ) Need Help??


in reply to Apache Registry with Server Side Includes

If you use <!--#inculde virtual="..." --> instead of file="...", mod_include does an internal request, which executes CGI scripts in the same way as if they were called externally.

Is that what you want? If not, please be more specific, and show some code (relevant apache config, scripts, includes, ...) and desired and actual output.


Comment on Re: Apache Registry with Server Side Includes
Select or Download Code
Re^2: Apache Registry with Server Side Includes
by bbfan (Novice) on Jan 01, 2012 at 21:52 UTC
    Moritz - Thank you. Your answer solved the problem. Scripts called using "#include virtual" are registry-ized.

    FWIW, was using:

    <!--#exec cmd="script arg1=x arg2=y"-->
    The doc clearly indicates using "virtual" over "exec" (and gives the added benefit passing in params the CGI way.)
    http://httpd.apache.org/docs/2.0/mod/mod_include.html
      Hello Monks,

      Although the problem of getting a SSI-invoked script into Apache Registry was "solved", it seems that the scripts in my (and maybe your?) Apache Registry directory take on a behavior that is, in my case, undesired. Specifically, calling the same script several times within a SSI-parsed file causes each invocation of the script to use the same argument as was passed in from the first invocation.

      To clarify, please find inlined below a simple SSI/shtml file and a script:

      <!-- file test.shtml --> <html> <head></head> <body> <!--#include virtual="/cgi-bin/test.cgi?count=5"--> <!--#include virtual="/cgi-bin/test.cgi?count=10"--> <!--#include virtual="/cgi-bin/test.cgi?count=30"--> </body> <html> #!/usr/bin/perl -w # test.cgi use strict; use CGI qw(-compile :all); my $count = param('count'); my $a = 0; print header; while ( $a < $count) { print ++$a; }

      When run from the default /var/www/cgi-bin/ directory, execution works as expected. However, when run from the Apache Registry directory below, each invocation counts only to 5.

      <Directory /var/www/registry> SetHandler perl-script PerlResponseHandler ModPerl::Registry # PerlOptions +ParseHeaders (prevented 2+ invocations) Options +ExecCGI </Directory>

      Any insights would sure be appreciated... Thanks!

        Try using CGI::Simple instead of CGI.pm (at least for testing purposes).   I've occasionally seen similar weirdness with CGI.pm (i.e. parameters not being cleared/reread upon subsequent requests) when being used in persistent contexts, and switching to CGI::Simple fixed it.

        Any insights would sure be appreciated... Thanks!

        A feature is a feature, read the docs, look for "sticky"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://945805]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2014-12-29 03:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (184 votes), past polls