LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   SSI works from #exec, but not from #include. (https://www.linuxquestions.org/questions/linux-general-1/ssi-works-from-exec-but-not-from-include-356539/)

SkipHuffman 08-24-2005 12:01 PM

SSI works from #exec, but not from #include.
 
This page:

Code:

<html>
        <head>
                <title>Hit Me</title>
        </head>
        <body>
                <h2>Test Page</h2>
                <ol>
                        <li><!--#include virtual="something.html"-->
                        <li><!--#include virtual="../cgi-bin/Hello.pl"-->
                        <li><!--#exec        cmd="../cgi-bin/Hello.pl" -->
                        <li><!--#include virtual="something_else.html"-->
                </ol>
                <p> end testing
        </body>
</html>

This cgi:
Code:

#!/usr/bin/perl -wT

print "<H2>Hello</h2>";

This result:
Code:

Test Page

  1.      something
  2. [an error occurred while processing this directive]
  3.      Hello
  4.      something else

end testing

Why does the script fail on item 2 but succed on item 3?

Thanks

Rotwang 08-24-2005 09:32 PM


oops nevermind, I misread your question. I think the reason it's not working is that executables need to be in an exec. Includes just paste the file in- don't execute anything.

SkipHuffman 08-24-2005 10:15 PM

Quote:

Originally posted by Rotwang
oops nevermind, I misread your question. I think the reason it's not working is that executables need to be in an exec. Includes just paste the file in- don't execute anything.
So the book that I am reading "Writing CGI Applications with Perl" http://tinyurl.com/chfxu is just plain wrong? I have found a couple of minor errors, but that is a huge one.

Also the Apache documentation http://httpd.apache.org/docs/2.0/howto/ssi.html says that I should be able to do it:

Quote:

Including the results of a CGI program

This is one of the more common uses of SSI - to output the results of a CGI program, such as everybody's favorite, a ``hit counter.''

<!--#include virtual="/cgi-bin/counter.pl" -->

I think I am just missing some sort of permissions.

Rotwang 08-25-2005 02:22 AM

Oh wow, I'm wrong then. Hmm.. I wonder what's the point of the exec directive... If include can do the same thing...

To change perms you probably just need:

chmod +x Hello.pl

Hmm but maybe there's a setting in apache to permit executable #includes as well.

SkipHuffman 08-25-2005 07:16 AM

Quote:

Originally posted by Rotwang
Oh wow, I'm wrong then. Hmm.. I wonder what's the point of the exec directive... If include can do the same thing...
I think, but I may be wrong, that "#exec" is intended as sort of a generic. The output of any command can be dumped to the document. I think "#include" is expecting more formatted data.

Quote:

To change perms you probably just need:

chmod +x Hello.pl

Don't teach your granny to suck eggs, son. ;-)

I meant something in .htaccess or httpd.conf
Quote:

Hmm but maybe there's a setting in apache to permit executable #includes as well.
Yeah, that is my thinking.

Thanks anyway.


All times are GMT -5. The time now is 06:54 PM.