Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Linux CGI problem

From: jason:cunliffe:verizon at: 3-Jun-2002 11:15

> 3. Inside the browser, I got only one word for response > > REBOL
Not sure if this helps or not... What is your script? Is it trying to return something to display to the browser? If so, then you need some kind of http header at the beginning of your script, or the browser won't see anything. Common ones are: textheader: "Content-Type: text/plain^/" htmlheader: "Content-Type: text/html^/" jsheader: "Content-type: script/javascript^/" xmlheader: "Content-Type: text/xml^/" print htmlheader ;; or another one, then your code below etc... But even if it your script is not rendering HTML, you do need to make sure you CAN do that to help reveal other problems. Have you written a minimal hello.r script ? %hello.r ----------------------------------- #!/home/pat665/core/rebol -cs REBOL [] print "Content-type: text/html^/^/" print "hello" ----------------------------------- If that works, then spiff it up by defining and ordering REBOL words for the essential HTML tags: <html><head><title></title></head><body></body></html>. Then insert some local task, like listing the current directory in between the <body></body> tags: ;list-directory result: make string! 256 dir: copy [] dir: read %. foreach file dir [ append result rejoin [file "<br>"]] print result Turn it into a function and then factor it out, saving to a separate script %list-directory.r. Test manually in both Linux and REBOL shells. Then load it in %hello.r and test it there.. Also keep a Linux shell opens and run this Apache error check often to see what Apache is saying and doing: tail -20 /var/log/httpd/error_log # <<== or wherever your Apache log is If you get this message in error_log: [Wed Apr 10 14:05:14 2002] [error] [client] Premature end of script headers: /var/www/cgi-bin/somescript.r ...then its a Linux permission problem. Usually your script is not running as the right user, or its trying to do something it's not allowed to do, like read/write to a directory its shouldn't. A helpful test can be to write a utility HTML page to expose REBOL's system/options/cgi If you have PHP installed, I have also found it helpful to use that, since it is so nicely integrated with Apache. The simplest PHP cgi magic I know is: info.php ---------- <? phpinfo(); ?> ---------- That returns a magnificent table including a section "Apache Environment". It would be nice if REBOL bundled such a sweet tiny cgi tool to help people get up and running on servers. hth ./Jason