FastCGI and Ruby (not Rails!)
Posted by: greyfade
Posted on: 2009-05-01 11:00:00
Ok, I've just set up a test domain and enabled FastCGI from the panel. I've confirmed that FastCGI is running my dispatch.fcgi, but I've run into a problem I can't solve.
My log file reads:
[Thu Apr 30 17:25:13 2009] [error] [client 65.116.251.178] FastCGI: comm with (dynamic) server "/home/greyfade/test.example.org/dispatch.fcgi" aborted: (first read) idle timeout (60 sec)
[Thu Apr 30 17:25:13 2009] [error] [client 65.116.251.178] FastCGI: incomplete headers (0 bytes) received from server "/home/greyfade/test.example.org/dispatch.fcgi"
The script in question is pretty simple:
#!/usr/bin/ruby
require 'fcgi'
FCGI.each_cgi {|cgi|
puts cgi.header("text/html")
puts "<html><head></head><body><pre>"
puts "testing"
puts "</pre></body></html>"
}
But it never sends headers. Running the script at the command-line just freezes, and any input causes the script to quit and hang somewhere inside the each method. Even this simple example doesn't work:
#!/usr/bin/ruby
require 'fcgi'
FCGI.each {|req|
req.out.print "Content-Type: text/plain\r\n\r\n"
req.out.print "test\r\n"
}
On the rare instances I can get it to work on another server, copying the file to DH still results in the same problem I've been having.
Is FCGI a broken pile of feces, or am I really doing something wrong, as DH support suggests?