pass variables using #exec cgi
[1/6] from: norsepower:uswest at: 7-Feb-2001 16:09
How can I immediately execute a rebol .cgi file when the user browses to the
index.html file?
For example, the following doesn't seem to work...
<!--#exec cgi="cgi-bin/display-messages.cgi?messageType=news&messageID=none"-
->
putting test.domain.com/cgi-bin/display-messages.cgi?messageType=news&
messageID=none in the address bar of the browser works fine, but I can't seem
to pass variables using the #exec server-side include command.
Anyone?
-Ryan
[2/6] from: gjones05::mail::orion::org at: 7-Feb-2001 19:11
Hi, Ryan,
Could be several problems. First, for Apache, you likely will need to change
the file's extension to .shtml. This is the file extension that the server
intercepts in order to act on the commands. If that doesn't fix the
problem, then depending on which directory the index.shtml file is in, you
may need to add the root path.
<!--#exec
cgi="cgi-bin/display-messages.cgi?messageType=news&messageID=none"-->
to
<!--#exec
cgi="/cgi-bin/display-messages.cgi?messageType=news&messageID=none"-->
If that doesn't fix it, then I would start assuming that the server has not
been set up to allow server side includes. In the httpd.conf file, uncomment
the following lines that begin with Add.
# To use server-parsed HTML files
#
#AddType text/html .shtml
#AddHandler server-parsed .shtml
to
# To use server-parsed HTML files
#
AddType text/html .shtml
AddHandler server-parsed .shtml
Then save the httpd.conf file, then start/restart Apache.
If that doesn't fix it, then there maybe some other configuration setting
that is not correct. For example, if the directory has an .htaccess file,
the directives in that file will over-ride those in httpd.conf.
If you are using IIS, then forget almost everything you just read, delete
this email and look for other responses ;-)
I suspect the file extension may be all that you need to do. Good luck.
--Scott
[3/6] from: gchiu:compkarori at: 8-Feb-2001 17:16
On Wed, 07 Feb 2001 16:09:12 -0600
"<[norsepower--uswest--net]>" <[norsepower--uswest--net]> wrote:
> How can I immediately execute a rebol .cgi file when the
> user browses to the
> index.html file?
>
> For example, the following doesn't seem to work...
>
> <!--#exec cgi="cgi-bin/display-messages.cgi?messageType=news&messageID=none"-
> ->
Should this be index.shtml?
Can you try doing <img src=/cgi-bin/display-messages.cgi?
... >
--
Graham Chiu
[4/6] from: mike:prwebcast at: 8-Feb-2001 0:02
On Wednesday, February 07, 2001 11:17 PM
> On Wed, 07 Feb 2001 16:09:12 -0600
> "<[norsepower--uswest--net]>" <[norsepower--uswest--net]> wrote:
>
> > How can I immediately execute a rebol .cgi file when the
> > user browses to the
> > index.html file?
Please forgive me if I'm butting in here, but I just joined this list a few
hours ago - just to have this exact same question answered! What timing!
:-)
I'm in an Active Server Pages environment; my include files are called with:
<!--#include virtual="/path/file.asp"-->
When I try to do:
<!--#include virtual="/cgi-bin/file.r"-->
The server just spits out the Rebol code onto the page as text.
If I try:
<!--#exec cgi="/cgi-bin/file.r"-->
The server ignores this command (viewing the source just shows this code on
the page - as if it were a comment). (ASP doesn't do "exec"?)
If I do:
<a href="/cgi-bin/file.r">file</a>
The page executes correctly.
Any help is greatly appreciated.
Mike Rozack
Internet Developer
PRWebcast
[mike--prwebcast--com]
[5/6] from: kevin:sunshinecable at: 7-Feb-2001 21:37
On Wed, 7 Feb 2001, <[norsepower--uswest--net]> wrote:
> How can I immediately execute a rebol .cgi file when the user browses to the
> index.html file?
<<quoted lines omitted: 4>>
> messageID=none in the address bar of the browser works fine, but I can't seem
> to pass variables using the #exec server-side include command.
Ryan,
Try:
<!--#include virtual="/cgi-bin/display-messages.cgi?messageType=news&messageID=none"
-->
I just tested this on a Linux server running Apache -- it worked fine.
If the parameters can be passed via the command line, you could also use
something like:
<!--#exec cmd="/usr/local/apache/cgi-bin/display-messages.cgi news none" -->
Also, note the space before the -->. It's important that it be there.
Cheers,
Kev
[6/6] from: norsepower:uswest at: 8-Feb-2001 9:12
For the record, "yes" I was using a .shtml file, not .html.
8-)
Here is how I solved the problem:
Instead of an index.shtml file, I use an index.cgi file which executes a
REBOL script as follows:
#!cgi-bin/rebol -cs
REBOL []
print "Content-Type: text/html^/" ;-- Required Page Header
print read http://www.domain.dom/cgi-bin/display-messages.cgi?messageTypenews&messageID=none
This is what I intended to do in the first place using the #exec cgi command
in an .shtml file to pass variables. Since I couldn't get #exec cgi to pass
variables, I let REBOL do the work.
Thanks.
-Ryan
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted