Problem integrating rails into apache

Hi all,

I’ve read the guide on integrating rails into apache on the
wiki.rubyonrails.com wiki, but I run into a problem.

I am trying to get the cookbook application as treated in the onlamp
tutorial about ruby on rails to work form apache. I can view the
index.html, but visiting cookbook/recipe/list gives me

Application error

Change this error message for exceptions thrown outside of an action
(like in Dispatcher setups or broken Ruby code) in public/500.html

An error appears in development.log about
Operation not permitted -
/web/rails/cookbook/public/…/config/…/tmp/sessions//ruby_sess.2e1330f3de760fc2
/usr/lib/ruby/1.8/cgi/session/pstore.rb:72:in `chmod’
etc…

The complete error log and all configuration stuff can be found on
http://smokeyd.homelinux.com/tmp/rails.html
I hope someone can help me figure this out.
Thanks!

SmokeyD wrote:

An error appears in development.log about
Operation not permitted -
/web/rails/cookbook/public/…/config/…/tmp/sessions//ruby_sess.2e1330f3de760fc2
/usr/lib/ruby/1.8/cgi/session/pstore.rb:72:in `chmod’

As I already guessed, the problem was permission related. Rails tries to
chmod the ruby.sess… files in /tmp/sessions/. I had the
files with permissions 777 (everybody rwx on windows), but I didn’t
realize that in order to chmod a file, you have to be the actual owner
of the file, not just a member of the owning group. So I changed the
owner to the user under which apache is running and the problem was
solved.

A tip to apache2 users though, use mod_fcgid to speed up rails. The
alternative mod_fastcgi isn’t really good. I read bad things about it on
the internet, but most of all, I couldn’t get rails to work with
mod_fastcgi, but could with mod_fcgid. See Paul’s journal on
http://journal.paul.querna.org/articles/2006/01/01/using-mod_fcgid-for-ruby-on-rails-applications

If you’re using debian or any debian based system, skip steps 1-6. Just
install libapache2-mod_fcgid and make sure there are symlinks in
/etc/apache2/modules-available to the fcgid files in
/etc/apache2/modules-enabled.