# Dreaded "Application error" Apache2

**URL:** <https://www.ruby-forum.com/t/dreaded-application-error-apache2/49553>\
**Category:** Rails\
**Created:** [December 6, 2005, 2:15am UTC](https://www.ruby-forum.com/t/dreaded-application-error-apache2/49553 "2005-12-06T02:15:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [December 6, 2005, 2:15am UTC](https://www.ruby-forum.com/t/dreaded-application-error-apache2/49553/1 "2005-12-06T02:15:53Z")

</div>

Hello,

I’ve been struggling for well over 6 hours which qualifies me as  
being allowed to post a question to the list.

I am trying to get my Rails application to run under Apache. It works  
fine with WEBrick. Apache is failing in both the cgi and fastcgi modes.

Configuration: Rails 0.14.3, Apache 2.0.50, Ruby 1.8.3, Postgres 8.1,  
fcgi-2.4.0, ruby-fcgi-0.8.6.1, SaltedHashLoginGenerator

The permissions all seem to be fine (0755 on the dispatch.\* files,  
although many variations succeeded and failed as expected) and the  
path to Ruby is correct (#!/usr/local/bin/ruby)

No matter what I do, I get the dreaded “Application error Rails  
application failed to start properly” error. Some of the interesting  
things I’ve found include:

When I run public/dispatch.rb, public/dispatch.cgi, and public/  
dispatch.fcgi I get a “Status: 500 Internal Server Error”. Is this  
normal?

How about this excerpt from the console, entering the contents of  
dispatch.cgi line-by-line, and then trying variations until things work:

Loading development environment.

> > require File.dirname( **FILE** ) + “/…/config/environment” unless  
> > defined?(RAILS\_ROOT)  
> > =\> nil
> 
> > require File.dirname( **FILE** ) + “/…/config/environment”  
> > /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/initializer.rb:  
> > 222: warning: already initialized constant Controllers  
> > =\> true
> 
> > require “dispatcher”  
> > =\> true
> 
> > ADDITIONAL\_LOAD\_PATHS.reverse.each { |dir| $:.unshift(dir) if  
> > File.directory?(dir) } if defined?(Apache::RubyRun)  
> > =\> nil
> 
> > ADDITIONAL\_LOAD\_PATHS.reverse.each { |dir| $:.unshift(dir) if  
> > File.directory?(dir) }  
> > NameError: uninitialized constant ADDITIONAL\_LOAD\_PATHS  
> > from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.3/  
> > lib/active\_support/dependencies.rb:200:in `const\_missing’  
> > from (irb):4
> 
> > Dispatcher.dispatch  
> > Status: 500 Internal Server Error  
> > =\> 35
> 
> >

Does this make sense? I get the same kind of error from the .fcgi:

Loading development environment.

> > require File.dirname( **FILE** ) + “/…/config/environment” unless  
> > defined?(RAILS\_ROOT)  
> > =\> nil
> 
> > require File.dirname( **FILE** ) + “/…/config/environment”  
> > /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/initializer.rb:  
> > 222: warning: already initialized constant Controllers  
> > =\> true
> 
> > require ‘fcgi\_handler’  
> > =\> true
> 
> > RailsFCGIHandler.process!  
> > Status: 500 Internal Server Error  
> > =\> true

Strange that it replies “true”…

Does anyone have any idea? Will switching to lighttpd allow me to  
avoid this problem?

Thanks for your help,

Paul.

---

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [December 6, 2005, 3:42pm UTC](https://www.ruby-forum.com/t/dreaded-application-error-apache2/49553/2 "2005-12-06T15:42:51Z")

</div>

One thing that bit me was in the dispatch.fcgi. Check the first line,  
is it pointing to the right spot for ruby? Looks as though your on a  
linux environment, so something like ‘/usr/local/bin/ruby’ or where  
ever it may be should do the trick.

If thats not it, are any log files getting generated when you try to  
start apache? If so which ones?

Also, check to make sure you actually have the requested envirornments  
database loaded, if not this leads to weird errors that you wouldn’t  
expect (dont ask how I know). 🙂 Its probably not an issues as it  
looks like you are trying to run in the same env as the webrick  
server.

-Nick

---

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [December 6, 2005, 3:47pm UTC](https://www.ruby-forum.com/t/dreaded-application-error-apache2/49553/3 "2005-12-06T15:47:01Z")

</div>

One more note, there was another problem I had like this where the 500  
error would seem to pop up and random. I also use the SaltedLogin  
generator, but I have more then one class/user type that requires  
authentication. I had forgot to require the second user type to my  
lib/login\_system.rb so that when it was getting the information from  
the cookies it wouldn’t marshal the objects back out correctly. (took  
me a bit to find that one too)

Hope some of this helps!  
-Nick
