Guile Scheme and CGI?

I recently discovered that CGI scripts can be written in almost any language that can print to stdout. I wrote a little cgi script trick that works on my local apache installation, 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 the shell on my host via ssh:

 $ ./scheme.cgi Content-Type: text/html hi 

So, obviously, my host is installed. However, when I try to access this file in the browser, I get a "500 Internal Server Error". When I look at my error logs, I see that I am getting a terrible "premature end error script":

 [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 

Since I'm on a shared host, using mod_lisp or a vile fastcgi implementation is out of the question. Say what could be here? Similar cgi scripts that I wrote in python, perl, ruby โ€‹โ€‹and sh work on the server without errors. I see that guile 1.8.7 is installed on the host, but my local computer is in the newest version.

I understand that this is an incredibly niche issue, any help would be appreciated!

+6
scheme apache2 cgi guile
source share
3 answers

You can also compile your own copy of guile or whatnot and save it in the ~ / bin / directory and there are scripts there.

+6
source share

I believe the error means that your web server process does not have access to the interpreter /usr/local/bin/guile . Check permissions on this file, make sure that it is accessible if the server is running in chroot or under mandatory access control, etc. And double check script permissions while you are on it.

+4
source share

It turns out that the / usr / local / bin directory, which exists when I'm on the ssh'ed server, is different from / usr / local / bin, when the script is serviced and opened through the browser, I found out which interpreters were available through this CGI script:

 #!/bin/sh echo "Content type: text/html\r\n\r\n" echo "ls /usr/local/bin" 

When I ran this script through a browser, I found that mzscheme was specified, but not guile. So the problem is solved, I am using mzscheme.

Thanks Carl.

+1
source share

All Articles