Rebol CGI gremlin under Apache2

Very little is required to run Rebol CGI scripts under Apache’s HTTP server if you are already running Perl or PHP scripts.

What spooked me was a peculiar echo in my HTML page of

Content-Type: html/text

which I could not shake.

There was an explanation. On my first test I used the singularly unimaginative file name of rebol.r just to be sure that I did not need to use a CGI file extension, e.g., rebol.cgi

Because my initial rebol.r worked fine, I went on to try test_002.r and my problems began …

It turns out that even in a /cgi-bin directory, if Rebol finds a file called Rebol.r then that file is executed before your own file.

Now this could be useful as a default header for all rebol CGI scripts in that directory. But if a script contains its own

prin “Content-Type: text/html”

the ghost will have been inserted into the machine.

Once I had renamed rebol.r to rebol_0001.r all was well. The following test script works fine:

#!I:/rebol/core/rebol.exe -cswq
Rebol [
Title: "CGI test 004"
]
prin "content-type: text/html^/^/"

comment {filename is rebol_004.r
test URl is http://localhost:8080/cgi-bin/Rebol_004.r
}

html32: make string! 2048

emitr: func [dat] [repend html32 dat]

emitr [{ html header goes here} ]

emitr [{ some dynamic html goes here
}]

emitr: [{closing html tags go here}]

prin html32

On with Rebolting Web Pages!

Leave a Reply

You must be logged in to post a comment.