Home   Archive   Permalink

cgi script error apache httpd rebol 64 bits

I'm following http://www.learnrebol.com/rebol3_book.html with r3-64-view-linux version
Tried to run a simple rebol script in the cgi-bin of my apache httpd server running in Linux, but always get the 500 Internal Server Error - "The server encountered an internal error or misconfiguration and was unable to complete your request."
# tail -1 /var/log/httpd/access_log                - - [12/May/2014:20:54:15 +0100] "GET /cgi-bin/html1 HTTP/1.1" 500 528
# tail -1 /var/log/httpd/error_log                        
[Mon May 12 20:54:15.350449 2014] [cgi:error] [pid 29990:tid 140558383466240] [client] malformed header from script 'html1': Bad header: XOpenDisplay failed, graphics
(Maybe this XOpenDisplay is the clue...)
Tried this with several rebol scripts, the most simple one is
#!/usr/local/bin/rebol -cs
R E B O L []
print {content-type: text/html^/}    
; the line above is the same as: print "content-type: text/html^/"
submitted: parse (to string! read system/ports/input) "&="
print {<HTML><HEAD><TITLE>Page title</TITLE></HEAD><BODY>}
print rejoin [{Hello } second submitted {!}]
print {</BODY></HTML>}
In my httpd.conf:
<Directory "/srv/httpd/cgi-bin">
    AllowOverride None
    #Options None
    Options +ExecCGI
    Require all granted
I can run the test cgi scripts provided by apache in the same directory.

posted by:   Luis Mendes       12-May-2014/16:04:14-7:00

Not too handy myself with internet stuff, but, whenever I try to set up cgi somewhere, my first test program does absolutely nothing but display some fixed text, like maybe header line and a one-line paragraph. Absolutely nothing else. That saves me from having a script crash on some stupid head-slapping syntax error that I looked right at and did not see. Not that you have that, but what if there is something wrong with your parse statement, or the system object in R3 is different, or you have to run in 32-bit emulation, etc., etc. The first thing to do is make absolutely sure it is not your fault.

posted by:   Steven White       13-May-2014/21:02:36-7:00

Hi Louis,
You're using the /View version on your server, which requires some additional dependencies that aren't needed for CGI processing. Try using this version and let me know what happens: http://guitarz.org/rebol3/rebol3

posted by:   Nick       14-May-2014/10:04:13-7:00

Hi Nick,
Thank you for your support.
I've been trying to solve this issue, but still with no success.
The file you sent me is for 32 bits and my system is 64 bits.
I managed to setup up a 32 bits vm to run my .cgi. With apache httpd there was no output and no reason shown, either in the browser or in logs.
But with lighttpd the web server returns:
XOpen Display failed, graphics is not supported.
content-type: text/html
and so on
Maybe I'm wrong, but it seems to me that rebol executable is trying to load the 'view' graphical code. This happens as well with the binary you sent me.
To solve this, I tried to download and compile only r3-core from http://github.com/zsx/r3
(The binary I used before yours was from Atronix.)
The problem is that I cannot compile it because in make directory, r3-make-linux points to a non-existent r3-make file.
So, I don't know what to do now...

posted by:   Luis       28-May-2014/6:21:19-7:00

There's a 64 bit Linux R3 Core build here:
There's a discussion about building R3 64 bit here:
(AltME is the place to go if you'd like to get involved more with building).

posted by:   Nick       28-May-2014/8:28:50-7:00

It finally worked with http://rebolsource.net/downloads/experimental/r3-linux-x64-g22b126b

posted by:   Luis       28-May-2014/18:40:27-7:00