Rails 2.3.2, Apache2 and CGI not working

Hi,

I am trying to deploy a trivial rails application on an apache server,
using the, as I understand obsolete, CGI way.

First of all, some versions:

System: Debian 5.0
Apache: Apache 2.2.9
Ruby: 1.8.7
Gem: 1.3.1 (manually installed, downloaded from rubyonrails.org)
Installed gems:
actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activeresource (2.3.2)
activesupport (2.3.2)
rails (2.3.2)
rake (0.8.4)

Contents of the .htaccess file in my rails app’s public directory:
(A cluster of howtos seems to agree that this is what it’s content
should be.)

Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
SetEnv RAILS_ENV production
RewriteEngine on
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

This is how I created my rails application (according to:
Ruby on Rails 2.3 Release Notes — Ruby on Rails Guides):
rails railstest --with-dispatchers

My problem is, it won’t work. I get the following error:

/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/cgi_process.rb:22:in
__send__': You have a nil object when you didn't expect it! (NoMethodError) The error occurred while evaluating nil.env_table from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/cgi_process.rb:22:in dispatch_cgi’
from
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:102:in
dispatch_cgi' from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:28:in dispatch’
from ./dispatch.cgi:10

I can’t find anything in particular about that problem, can you help me?

Fut Lib wrote:

Hi,

I am trying to deploy a trivial rails application on an apache server,
using the, as I understand obsolete, CGI way.

CGI support will be removed certainly in the next release, so don’t
waste your time trying to make it work.

Fernando P. wrote:

Fut Lib wrote:

Hi,

I am trying to deploy a trivial rails application on an apache server,
using the, as I understand obsolete, CGI way.

CGI support will be removed certainly in the next release, so don’t
waste your time trying to make it work.

Fair enough. I was actually looking for an easy solution to use rails
and e.g. php apps in the same vhost.

Setting up some mongrel rails server for a single trivial rails
application seemed like overkill.

Passenger is basically exactly what I’m looking for, except that it is
probably not exactly stable in the debian sense and seems to conflict
with mod_rewrite which I really can’t have.

Is there anything else?
Otherwise, I suppose I’ll have to go with mongrel anyways until
passenger is mature.

Sorry for double posting.

I ended up using mod_passenger, and after some obstacles, it worked
fine.

There’s a number of bugs I’ve worked around and which should really be
fixed:
http://code.google.com/p/phusion-passenger/issues/detail?id=169&q=rails_relative_url_root&colspec=ID%20Type%20Status%20Priority%20Milestone%20Stars%20Summary
http://code.google.com/p/phusion-passenger/issues/detail?id=13

Not to mention the alleged problems with mod_rewrite and mod_alias.

But other than that, I can really recommend this solution, works like a
charm!

Fut Lib wrote:

Fernando P. wrote:

Fut Lib wrote:

Hi,

I am trying to deploy a trivial rails application on an apache server,
using the, as I understand obsolete, CGI way.

CGI support will be removed certainly in the next release, so don’t
waste your time trying to make it work.

Fair enough. I was actually looking for an easy solution to use rails
and e.g. php apps in the same vhost.

Setting up some mongrel rails server for a single trivial rails
application seemed like overkill.

Passenger is basically exactly what I’m looking for, except that it is
probably not exactly stable in the debian sense and seems to conflict
with mod_rewrite which I really can’t have.

Is there anything else?
Otherwise, I suppose I’ll have to go with mongrel anyways until
passenger is mature.

No solution yet.
But I did a freeze on 2.2.2 to get it back working and I’m on my way to
find a new host. Considering hostingrails.com

Cheers

Hi,

My host (Bluehost) just upgraded to 2.3.2 and I’m now completely lost on
what to do next :stuck_out_tongue:

I get the same error as intially posted here.

/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/cgi_process.rb:22:in
__send__': undefined methodenv_table’ for nil:NilClass
(NoMethodError)

I was using CGI.
Could someone give a brief description of how to solve the issue?
I have virtual server I can’t completely control everything there.
Do I have to ask the host to install anything new? I found out that I
can install the gem rack, do I need to use that?

Any hints?

Thanks.