I recently discovered that CGI scripts can be written in pretty much any language that can print to stdout. I've written a small guile cgi script that works on my local apache install, but not on my shared host:
#!/usr/local/bin/guile -s
!#
(display "Content-Type: text/html")
(newline)
(newline)
(display "hi")
(newline)
This is the output, when I run the script from a shell on my host over ssh:
$ ./scheme.cgi
Content-Type: text/html
hi
So, obviously my host has guile installed. However, when I try to access this file in a browser, I get a "500 Internal Server Error". When looking at my error logs, I see that I am getting the dreaded "premature end of script headers" error:
[server.com] [Tue Aug 17 00:54:19 2010] [error] [client xx.xx.xx.xxx] (2)No such file or directory:
exec of '/home/www/vhosts/jcw.geekisp.com/cgi-bin/scheme.cgi' failed
[server.com] [Tue Aug 17 00:54:19 2010] [error] [client xx.xx.xx.xxx] Premature end
of script headers: scheme.cgi
Because I am on a shared host, using mod_lisp or guile's fastcgi implementation are out of the question. That being said, what could be the issue here? Similar cgi scripts I've written in python, perl, ruby, and sh work on the server with no errors. I see that guile 1.8.7 is installed on the host, but my local machine is on the newest version.
I understand that this is an incredibly niche question, any help would be appreciated!