Can't get rails working

I am trying to set up rails and am having problems. I have googled
everything I could think of, but have not found my problem. Here are my
specs.

Gentoo Linux 2006.0
Apache 2.2
Ruby 1.8.4
Gems 1.8
Rails 1.1.2
mod_fcgid 1.08

When I try to access my test rails app through the webserver, I get the
following error in the error.log (after seeing a html 500 error on the
page).

[Fri Apr 14 19:54:48 2006] [notice] mod_fcgid: server
/var/www/rails/cookbook/public/dispatch.fcgi(20039) started
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
const_missing': uninitialized constant RailsFCGIHandler (NameError) from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:inconst_missing’
from /var/www/rails/cookbook/public/dispatch.fcgi:25

I have seen suggestions to run ‘ruby dispatch.fcgi’ from the command
line, but I get the same error.

Any suggestions?

ps. I installed everything the WiKi said.

Apache
mod_fcgid
fcgi
gems
ruby
rails gem
fcgi gem

If you are just starting out developing with rails I would suggest use
webrick instead of apache, then move to apache when your application is
ready to be hosted for production. That way you don’t have to mess with
configuring apache to play nice until you are already familiar with
rails
itself. To run webrick just do: ruby script/server from your app’s root
then you should be able to get to it at http://localhost:3000/

Rob

Rob M. wrote:

If you are just starting out developing with rails I would suggest use
webrick instead of apache, then move to apache when your application is
ready to be hosted for production. That way you don’t have to mess with
configuring apache to play nice until you are already familiar with
rails
itself. To run webrick just do: ruby script/server from your app’s root
then you should be able to get to it at http://localhost:3000/

Rob

Thanks for your advice, but we are looking at using Rails for a
commercial app we are developing. If I can’t get it to work, there is
no point in using it.

Yeah, but you are obviously not familiar with rails so that is why I’m
saying during development use webrick then move to apache when you are
ready
to host. That way when you get these kinds of errors by then you should
know at least where to start looking for the solution.

my $0.02

Rob

Rob M. wrote:

Yeah, but you are obviously not familiar with rails so that is why I’m
saying during development use webrick then move to apache when you are
ready
to host. That way when you get these kinds of errors by then you should
know at least where to start looking for the solution.

my $0.02

Rob

What happens when I spend 4 months learning Rails and then I still can’t
get it set up and still get non-answers. Yes it is obvious that I am
not yet familiar with Rails and I appreciate your point of view, but I
don’t want to waste time I can’t afford to waste if I can’t get it set
up at all.

Matt R. wrote:

I agree completely. Work with webrick in development, then when you
start
getting errors you know what to do and where to look.

But sadly, I don’t know enough about Apache (I don’t deal with hosting
at
the moment) so I can’t help with your problem.

Good luck :slight_smile:

It is not a programming error. I just followed the tutorial for setting
up cookbook. I only went to the first step of setting up the the
recipes table in MySQL and adding the scaffold to the controller. It
works under WebRick, but it throws that error when trying to run it
under Apache.

I agree completely. Work with webrick in development, then when you
start
getting errors you know what to do and where to look.

But sadly, I don’t know enough about Apache (I don’t deal with hosting
at
the moment) so I can’t help with your problem.

Good luck :slight_smile:

There is nothing special about configuring Apache with FCGI for a Rails
app. FastCGI is a bit of a hassle but no chance is involved. It’s just a
matter of getting some libraries and a module installed and putting the
right six or seven lines in your configs. For me the most time-consuming
part was finding a version of Apache (out of 1.3, 2.0, 2.1 and 2.2) for
which one of the three or so available FastCGI modules compiled out of
the box. In my case, under FreeBSD, that was a post-January 2006 rev of
Apache 2.0.x and mod_fastcgi.

Please remember that when you see a lot of messages on this list from
people having problems, you’re seeing the ones having problems and that
a majority of these people come in knowing little or nothing about
configuring Apache so as they try to copy and paste from other people’s
HOWTOs, they don’t understand what they’re pasting in and can’t grasp
what they need to change for their own circumstances. You’re not seeing
the thousands of people who spent an hour downloading things, fiddled
with configs for a bit and got it all working before lunch. When you
understand that your app’s root is in public/ and how and when
dispatch.fcgi gets called, the rest will just be a matter of installig
the module and setting some paths.

Nobody who understands Apache config files, the layout of their
machine’s filesystem, how to install apps from packages and tarballs on
their OS, and the importance of file permissions is going to fail to get
Rails running properly on Apache. It may take a half-hour or it may take
most of a day, but it installs and works fine and there’s nothing
remotely insurmountable, magical or chancy about it. Once you do get it
going, you slap your forehead, understand what you were doing wrong, and
getting your second, third and fourth Rails apps running on Apache takes
five minutes. It can just be a steep learning curve for people used to
the one package and two lines of configuration needed to get PHP
running.

And in any event, if Apache configs are too scary, that’s why Lighttpd
was invented. Start developing, don’t think about Apache too much, and
when you’re ready to start experimenting with deployment to production,
study the config file examples for Rails on Apache and try to understand
what they’re doing. Then start downloading and installing things.

Mark Bernard wrote:

Rob M. wrote:

Yeah, but you are obviously not familiar with rails so that is why I’m
saying during development use webrick then move to apache when you are
ready
to host. That way when you get these kinds of errors by then you should
know at least where to start looking for the solution.

my $0.02

Rob

What happens when I spend 4 months learning Rails and then I still can’t
get it set up and still get non-answers. Yes it is obvious that I am
not yet familiar with Rails and I appreciate your point of view, but I
don’t want to waste time I can’t afford to waste if I can’t get it set
up at all.