# apache error

**URL:** <https://discuss.rubyonrails.org/t/apache-error/21234>\
**Category:** rubyonrails-talk\
**Created:** [December 4, 2007, 4:15pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234 "2007-12-04T16:15:39Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Moreno](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Alex\_Moreno](https://discuss.rubyonrails.org/u/Alex_Moreno)\
**Post date:** [December 4, 2007, 4:15pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/1 "2007-12-04T16:15:39Z")

</div>

Good afternoon,

newbie question. I suppose that it must be a normal one when you are beginning with ror, but i don´t find information to solve the problem.

The server in which i´m trying to run ror is a vps (virtual private server) with virtuozzo. Everithing seems ok, and plesk says that ror is correctly installed. In fact, i can execute and run everthing from / opt/ruby/bin/.

The problem appears trying to port my app to apache. Everthing is supossed to be correctly installed and configured (automagically by plesk)... but i get this error:

#!/opt/ruby/bin/ruby

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [December 4, 2007, 4:44pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/2 "2007-12-04T16:44:07Z")

</div>

> Good afternoon,
> 
> newbie question. I suppose that it must be a normal one when you are beginning with ror, but i don´t find information to solve the problem.
> 
> The server in which i´m trying to run ror is a vps (virtual private server) with virtuozzo. Everithing seems ok, and plesk says that ror is correctly installed. In fact, i can execute and run everthing  
> from / opt/ruby/bin/.
> 
> The problem appears trying to port my app to apache. Everthing is supossed to be correctly installed and configured (automagically by plesk)... but i get this error:

IIRC You need to add something like this to your apache config AddHandler fastcgi-script .fcgi

Fred

---

<div class="post-metadata">

**Author:** ![Alex\_Moreno](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Alex\_Moreno](https://discuss.rubyonrails.org/u/Alex_Moreno)\
**Post date:** [December 4, 2007, 4:55pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/3 "2007-12-04T16:55:14Z")

</div>

Thanks for the answer. I have:

&nbsp;&nbsp;\<IfModule mod\_fcgid.c\> &nbsp;&nbsp;&nbsp;&nbsp;AddHandler fcgid-script .fcgi &nbsp;&nbsp;&nbsp;&nbsp;Options +FollowSymLinks +ExecCGI &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;\</IfModule\>

i´ve added

AddHandler fastcgi-script .fcgi

but nothing happened ☹

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [December 4, 2007, 5:03pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/4 "2007-12-04T17:03:43Z")

</div>

> Thanks for the answer. I have:
> 
> &nbsp;&nbsp;\<IfModule mod\_fcgid.c\> &nbsp;&nbsp;&nbsp;&nbsp;AddHandler fcgid-script .fcgi &nbsp;&nbsp;&nbsp;&nbsp;Options +FollowSymLinks +ExecCGI &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;\</IfModule\>
> 
> i´ve added
> 
> AddHandler fastcgi-script .fcgi
> 
> but nothing happened ☹

What i said assumed you were running regular fastcgi, if you are  
rgunning fcgcid then you've got the right thing. The fact that you get the contents of dispatch.fcgi implies that it's  
not picking it up for some reason, but it's been a long time since i  
used fastcgi/fcgid so I'm out of ideas (a lot of people have moved  
away from this, which may be why you can't find much on this (There is  
some info at [http://wiki.rubyonrails.org/rails/pages/HowtoSetupApacheWithFastCGIAndRubyBindings](http://wiki.rubyonrails.org/rails/pages/HowtoSetupApacheWithFastCGIAndRubyBindings) &nbsp;&nbsp;but a lot of it seems quite old)

Fred

---

<div class="post-metadata">

**Author:** ![Jason\_Roelofs](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@Jason\_Roelofs](https://discuss.rubyonrails.org/u/Jason_Roelofs)\
**Post date:** [December 4, 2007, 5:06pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/5 "2007-12-04T17:06:03Z")

</div>

Make sure the she-bang line is correct for the server (which ruby)

Make sure dispatch.fcgi is executable (chmod +x dispatch.fcgi)

Jason

---

<div class="post-metadata">

**Author:** ![Alex\_Moreno](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Alex\_Moreno](https://discuss.rubyonrails.org/u/Alex_Moreno)\
**Post date:** [December 4, 2007, 5:36pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/6 "2007-12-04T17:36:43Z")

</div>

which ruby:

/usr/local/bin/ruby

dispatch is executable, no luck yet.

I have this line commented:

# Example: # RewriteRule ^(.\*)$ dispatch.fcgi [QSA,L]

if i uncomment i get the main html with an error:

About your application's environment Application error Rails application failed to start properly

wish it helps

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [December 4, 2007, 5:53pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/7 "2007-12-04T17:53:52Z")

</div>

That's getting somewhere - it's actually trying to execute stuff. In the past we've had problem like that when the user that the dispatch.fcgi was running under couldn't write session files (permissions problems) and stuff like that.

Fred

---

<div class="post-metadata">

**Author:** ![Jason\_Roelofs](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@Jason\_Roelofs](https://discuss.rubyonrails.org/u/Jason_Roelofs)\
**Post date:** [December 4, 2007, 6:22pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/8 "2007-12-04T18:22:20Z")

</div>

Change dispatch.fcgi:

#!/opt/ruby/bin/ruby

Should be

#!/usr/local/bin/ruby

Or as I prefer, a way that works on \*nix systems:

#!/usr/bin/env ruby

Jason

---

<div class="post-metadata">

**Author:** ![Alex\_Moreno](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Alex\_Moreno](https://discuss.rubyonrails.org/u/Alex_Moreno)\
**Post date:** [December 4, 2007, 6:39pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/9 "2007-12-04T18:39:14Z")

</div>

i´ve tested nearly all the posibilities (usr/local, env, ...) no luck ☹

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [December 4, 2007, 7:45pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/10 "2007-12-04T19:45:46Z")

</div>

> i´ve tested nearly all the posibilities (usr/local, env, ...) no  
> luck ☹

There's probably more than one thing wrong, but it sure as hell won't  
work with the wrong shebang.

Fred

---

<div class="post-metadata">

**Author:** ![Jason\_Roelofs](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@Jason\_Roelofs](https://discuss.rubyonrails.org/u/Jason_Roelofs)\
**Post date:** [December 4, 2007, 7:59pm UTC](https://discuss.rubyonrails.org/t/apache-error/21234/11 "2007-12-04T19:59:45Z")

</div>

Well now that we know you’ve got the right permissions on the file, and the right shebang, what do your logs say?

Jason

---

<div class="post-metadata">

**Author:** ![Alex\_Moreno](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Alex\_Moreno](https://discuss.rubyonrails.org/u/Alex_Moreno)\
**Post date:** [December 5, 2007, 8:23am UTC](https://discuss.rubyonrails.org/t/apache-error/21234/12 "2007-12-05T08:23:11Z")

</div>

What do you mean with shebang (sorry, newbie)? The logs on the apache directory doesn´t say anything... strange, isn´t it? I´ll check it for apache logs.
