After install: public/dispatch.cgi results in undefined method 'env_table' for nil:NilClass NoMethodError

Added by Harlan Milkove over 10 years ago

Hello,
I'm going through the guide located at http://www.redmine.org/wiki/redmine/HowTo_configure_Apache_to_run_Redmine and when attempting to confirm proper output from running public/dispatch.cgi I get the following error:

/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/dispatcher.rb:24: warning: already initialized constant Dispatcher
/home/username/ruby/gems/gems/actionpack-2.3.5/lib/action_controller/cgi_process.rb:22:in `__send__': undefined method `env_table' for nil:NilClass (NoMethodError)
        from /home/username/ruby/gems/gems/actionpack-2.3.5/lib/action_controller/cgi_process.rb:22:in `dispatch_cgi'
        from /home/username/ruby/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
        from /home/username/ruby/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:27:in `dispatch'
        from public/dispatch.cgi:11

I'm running Redmine through cpanel, and have been trying to figure out why I get a 404 page when attempting to access the entry page. The step above was part of my effort to track down the culprit.
The production log entry that resulted in the 404 is:

ActionController::RoutingError (No route matches "" with {:method=>:get}):

The 'No route matches ""' was "/management" before I added some suburi compatibility lines to my environment.rb, but the behavior is the same now. The path to Redmine is /home/username/management/.

RAILS_ENV=production script/about
/home/username/management/config/environment.rb:6: warning: already initialized constant RAILS_ENV
About your application's environment
Ruby version              1.8.7 (x86_64-linux)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          /home/username/management
Environment               production
Database adapter          mysql
Database schema version   20091227112908

Replies (9)

RE: After install: public/dispatch.cgi results in undefined method 'env_table' for nil:NilClass NoMethodError - Added by Ben Lau over 10 years ago

I have the same problem. It is my environment:

System : Debian Lenny
Redmine : 0.9.3

  • LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
fastthread (1.0.7)
passenger (2.2.7)
rack (1.1.0, 1.0.1)
rails (2.3.5)
rake (0.8.7)

RE: After install: public/dispatch.cgi results in undefined method 'env_table' for nil:NilClass NoMethodError - Added by Ben Lau over 10 years ago

sorry , I should use script/about to report:

System : Debian Lenny

# RAILS_ENV=production script/about
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.4
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          /usr/local/lib/redmine-0.9.3
Environment               production
Database adapter          mysql
Database schema version   20100221100219

RE: After install: public/dispatch.cgi results in undefined method 'env_table' for nil:NilClass NoMethodError - Added by Ben Lau about 10 years ago

Although I am not a ruby coder , I have tried to trace about the code. The code with problem is :


def self.dispatch_cgi(app, cgi, out = $stdout)
env = cgi.__send__(:env_table)
env.delete "HTTP_CONTENT_LENGTH"

The CGI is a nil variable. Then I back trace the code and found that cgi is never been set! There have no any condition checking code to create cgi object. So I really wonder that dispatch.cgi is already broken in 0.9.x series.

RE: After install: public/dispatch.cgi results in undefined method 'env_table' for nil:NilClass NoMethodError - Added by Al Muth about 10 years ago

i change mod_cgi with mod_passenger and its resolve the problem

Its my environment

Ruby version              1.8.6 (x86_64-linux)
RubyGems version          1.3.6
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5

RE: After install: public/dispatch.cgi results in undefined method 'env_table' for nil:NilClass NoMethodError - Added by Jose Mari Mor Fabregat about 10 years ago

I've the same error, and it's impossible to run redmine+apache. At the moment I'm playing with 'mod_rewrite' with excelents results (obviously with redmine included webserver).

Have you considered this option?

RE: After install: public/dispatch.cgi results in undefined method 'env_table' for nil:NilClass NoMethodError - Added by Dimitris Vi about 9 years ago

is this resolved? I am getting this with redmine 1.2

$ RAILS_ENV=production ruby script/about
About your application's environment
Ruby version              1.8.7 (x86_64-linux)
RubyGems version          1.6.2
Rack version              1.1.1
Rails version             2.3.11
Active Record version     2.3.11
Active Resource version   2.3.11
Action Mailer version     2.3.11
Active Support version    2.3.11
Application root          /home/aim/domains/aimbs.gr/public_html/redmine
Environment               production
Database adapter          mysql
Database schema version   20110511000000
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/cgi_process.rb:22:in `__send__': undefined method `env_table' for nil:NilClass (NoMethodError)
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/cgi_process.rb:22:in `dispatch_cgi'
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:27:in `dispatch'
    from dispatch.cgi:10

(1-9/9)