homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

cgi script embedded in html doesn't like arguments

 10:12 pm on Dec 1, 2003 (gmt 0)

I've got embedded cgi scripts working. That is, I can take this cgi script called /cgi-bin/helloworld.pl:

print "Content-Type: text/html; charset=ISO-8859-1\n\n";
print "Hello, world";

...and put it in this html file:

<!--#exec cgi="/cgi-bin/helloworld.pl" -->

And the page will properly display "Hello, World".
However, if I add an argument to the script call:

<!--#exec cgi="/cgi-bin/helloworld.pl?myarg=5" -->

I get the dreaded "[an error occurred while processing this directive]"

Are arguments forbidden for some reason?

It's a Linux Apache server.
Thanks for any help.

[edited by: sugarkane at 11:35 pm (utc) on Dec. 1, 2003]



 11:38 pm on Dec 1, 2003 (gmt 0)

You might have more luck trying

<!--#include virtual="/cgi-bin/helloworld.pl?myarg=5" -->

(although I admit it's quite a while since I've done any SSI ;-) )


 3:07 am on Dec 2, 2003 (gmt 0)

What? Include?

Sigh... Well, there goes another of my assumptions blown out of the water. I truly thought that "include" meant that it would try to print that file onto the screen, and "exec" meant that it would run the file.

Your suggestion worked, btw. Thanks. Next you're going to tell me there isn't a Santa Claus, right?


 8:36 pm on Dec 3, 2003 (gmt 0)

No, you used to be right, and "include" used to be just to include the contents of a file. But "include virtual" is a newer (relatively -- only a few years old) thing that calls the included file through the web server (or calls it as though it were calling it through the web server). For CGI scripts, this has the effect of executing the script, but I think you can do it for html and other files as well.

Lots of places have taken to disabling all forms of "exec" in SSI and using "include virtual" instead, which may be why you were having the problem.



[edited by: jatar_k at 10:05 pm (utc) on Dec. 3, 2003]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved