Ok. I tried the "\r\n" change but it still gets error 500. This is happening on a netbsd 3.1 server so LD_LIBRARY_PATH doesn't really apply. lighttpd runs as user www. I tried su'ing to user www and found I could still execute the script just fine from command line. As I said previously, changing the contents of the script to the code for the /bin/sh hello world worked fine too. strace is currently refusing to compile from pkgsrc or direct from source so I haven't been able to try looking into that yet. Does anyone happen to know how to write a policy for systrace to allow and log *all* system calls? That might help.
Marc: What is the distinction between my code and the code you commented on a few threads earlier as needing flush-output to require the buffers get drained? Does stdout drain whenever a process exits but ports for other opened files may need an explicit flush?
On 6/13/07, Marc Feeley feeley@iro.umontreal.ca wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 13-Jun-07, at 2:51 AM, |/|/ Bendick wrote:
Hi, I'm trying to use gambit 4.0b22 for CGI but am having a problem. A simple script:
#!/usr/local/Gambit-C/current/bin/gsi-script
(define (main . args) (display "Content-type: text/html\n\nhi\n\n") (force-output (current-output-port)) 0)
But I get a "500 - Internal Server Error" every time I try to hit the page. The web server (lighttpd-1.4.15) tells me the script is exiting with a return value of 11 which the gambit manual doesn't document. The script runs fine from command line. If I just throw:
#!/bin/sh
echo "Content-type: text/html" echo "" echo "hi";
into the file, it works correctly so it doesn't look like a permission/configuration/whatever error with the web server. Any ideas on code 11?
Do you know under what user the script is executed by lighttpd? With Apache I've had similar problems where the user did not have the permission to execute gsi-script.
Small comments about your code: 1) you don't need the (current-output- port) argument to force-output because it is the default, 2) you don't need the force-output because that will be done for stdout when the process exits. So the script could simply be:
#!/usr/local/Gambit-C/current/bin/gsi-script (display "Content-type: text/html\n\nhi\n\n")
Marc
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin)
iD8DBQFGb9DU//V9Zc2T/v4RAtfmAKCXJhaxGaffzOl2iN/vplAj69LfewCgjBH7 nhmMEmCh+6reGCDIAJx6fFw= =N/TH -----END PGP SIGNATURE-----