I have written a test cgi script works as
expected on my own machine using Person Web
Server.

It's acting strangely on a linux server using
Apache server.

On PWS, I see for content:
hello world from rebol script
as I would expect

On the Linux Server, the only content I see is:
REBOL 

I am enclosing first the SOURCE of the content
from the Linux server, and then the script itself.
thanks in advance.
tim

Here is the source of the content as posted
when I run it:
; content source below
        REBOL <options> <script> <arguments>

All fields are optional. Supported options are:

        --cgi (-c)       Check for CGI input
        --do expr        Evaluate expression
        --help (-?)      Display this usage information
        --nowindow (-w)  Do not open a window
        --quiet (-q)     Don't print banners
        --script file    Explicitly specify script
        --secure level   Set security level:
                                         (none write read throw quit)
        -s               Shortcut: no security
        +s               Shortcut: full security
        --trace (-t)     Enable trace mode

Examples:

        REBOL script.r
        REBOL script.r 10:30 [EMAIL PROTECTED]
        REBOL script.r -do "verbose: true"
        REBOL --cgi -s
        REBOL --cgi -secure throw --script cgi.r "debug: true"
        REBOL --secure none

Content-Type: text/html

<HTML><head><title> hello world </title></head> 
<h1>hello world from rebol script</h1></body></html>

;===========================================
;now, hello-world.r script source below
;============================================

#!/usr/bin/rebol -cs
REBOL
 [
    Title: "Test Rebol CGI script"
    Date:  28-Mar-2000
    File:  %hello-world.r
    Purpose: {just to see if we can get anything to work}
]
; functions
;========================================================================
fprint: func [fp1[port!] value]
[ append fp1 value ]
;========================================================================
write_to_file: func []
[
  either equal? system/options/cgi/server-name none
  [return true]
  [{else}return false]
]
;========================================================================
init_output: func[fname[string!] /local fpl]
[
  either write_to_file
  [
    file_name:  make file! fname
    fpl: open/new/write file_name
  ]
  [fpl: system/ports/output]
  return fpl
]
;========================================================================
text_html_header: func [fp1[port!]]
[either write_to_file [][fprint fp1 "Content-Type: text/html^/^/"]]
;========================================================================
html_header: func [fp1[port!] title[string!]]
[fprint fp1 reform ["<HTML><head><title>" title "</title></head>" newline]]
;========================================================================
html_footer: func [fp1[port!]] [fprint fp1 "</body></html>^/"]
;========================================================================
fp: init_output "hello.htm"
text_html_header fp
html_header fp "hello world"
;
fprint fp "<h1>hello world from rebol script</h1>"
html_footer fp
either write_to_file [close fp][]



Reply via email to