Fix for Rails 0.11.0 FastCGI Problems (Updated)

Update: The latest version of Rails (0.11.1) appears to fix this. Apps created in the time period between the release of 0.11.0 and 0.11.1 may still experience this problem, and the instructions below still apply. Rails can be updated to the latest version by typing sudo gem update rails --include-dependencies at the prompt.

After updating several installations of Rails to version 0.11.0 (using the sudo gem update rails command at the prompt), you have noticed that any new applications you create fail to work under FastCGI, generating errors like this:

dispatch.fcgi:3: uninitialized constant RAILS_ROOT (NameError)

The cause of this, it seems, is a missing constant definition in the dispatch.fcgi file, located in your Rails’ applications public folder.

To fix this problem, find the line that reads:

FASTCGI_CRASH_LOG_PATH = "#{RAILS_ROOT}/log/fastcgi.crash.log" 

It should be the second or third line of the file. Insert the following line right before it:


RAILS_ROOT = “/full/path/to/my/rails/app”


Of course the path above will need to be changed to match the actual path of the Rails application. On the OS X system you have here, you added the following line:

RAILS_ROOT = "/Library/WebServer/Documents/TestApp" 

Now, just restart Apache (or identify and kill any of FastCGI processes for your application) and try it again.

More articles in the Archive →