Help - deploying on Apache1.3/FCGI - Dispatcher failed to ca

Hi,
I am in need to deploy Rails application on CentOS with Apache 1.3 and
FCGI.
Nothing happens except these in fast_cgi_crash log:

30/Aug/2007:00:25:24 :: 11521] Dispatcher failed to catch: You have a
nil object when you didn’t expect it!
ou might have expected an instance of Array.
he error occurred while evaluating nil.split (NoMethodError)
/usr/lib/ruby/1.8/cgi.rb:898:in `parse’

Application work as CGI, or webrick or mongrel, I tried with clean
rails app (rails test) and tested with minimal test.fcgi and it all
works.

thanks for any thought on these,
Bojan

What happens in ssh when youruby script/server from the public dir?
It looks to me like you don’t have a htaccess file telling it to use
fcgi
instead of cgi.

Sample htaccess that we use on one of the servers using apache 1.3 and
fcgi:

General Apache options

AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

Redirect all requests not available on the filesystem to Rails

By default the cgi dispatcher is used which is very slow

For better performance replace the dispatcher with the fastcgi one

Example:

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

RewriteEngine On

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

  • Greg

Do you have any other rails apps running on this server? I’m trying to
determine if your fcgi processes are even working. Also check all your
permissions. Can you post back your htaccess file?

  • Greg

Hi Greg,
I can ruby script/server normally, and it works when I set it to cgi
instead of fcgi. .htaccess is similiar to one you posted.
But still no works :frowning:

.htaccess

AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 “

Application error

Rails application failed
to start properly”

Permissions:
-rwxr-xr-x 1 elansnow elansnow 855 Aug 30 00:25 dispatch.fcgi*
-rw-r–r-- 1 elansnow elansnow 1252 Aug 30 10:33 .htaccess

I do not have any other rails app on this machine. I have created
minimal ruby script to test if FCGI is working and it seems it is as I
get expected output from this:

#!/usr/bin/ruby
require ‘rubygems’
require “fcgi”
FCGI.each_cgi {|cgi|
name = cgi[‘name’][0]
puts cgi.header
puts "You are #{name} " if name
puts “Connecting from #{cgi.remote_addr}”
}

While when I start dispatch.fcgi from command line errors get written
in fast_cgi_crash_log and nothing more.

Ok. I don’t see anything wierd here.Check the first line of your
dispatch.rb, dispatch.fcgi and dispatch.cgi files and make sure they are
correctly pointing to ruby.

  • Greg