Rails "Application Error" with apache and mod_fcgid

Hello,

I have a gentoo system that I am trying to remotely develop rails
applications on using apache and fcgi. I created the simple hello world
example from Dave T.’ book to test the system and I receive an
“application error” when I try to go to the page. I can startup webrick
and use links to view the page just fine, but nothing doing through
apache.

I have looked at many tutorials that google has turned up and can’t seem
to find what I’m doing wrong. Here are the versions I’m using:

apache-2.0.55-r1 mod_fcgid-1.07-r1 ruby-fcgi-0.8.6 mysql-4.1.19 mysql-ruby-2.7 DBD-mysql-2.9007 rails-1.1.2 actionmailer-1.2.1 actionpack-1.12.1 actionwebservice-1.1.2 activerecord-1.14.2 activesupport-1.3.1 rake-0.7.1

My apache httpd.conf file has these lines added:

LoadModule fcgid_module modules/mod_fcgid.so AddHandler fcgid-script .fcgi

My vhosts.conf file has:

<virtualHost *:80> DocumentRoot /var/www ServerName myServer.com ErrorLog /var/www/apache.log
&lt;Directory "/var/www"&gt;
    Order deny,allow
    Options none
    AllowOverride none

</Directory>
<Directory “/var/www/rails”>
Options ExecCGI FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

In my rails public folder I’ve added:

AddHandler fcgid-script .fcgi RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

I tried running “ruby -d dispatch.fcgi” to see what the problem is and I
get a long list of complaints that I can’t pinpoint whats wrong. Here
is that output:

linuxserver public # ruby -d dispatch.fcgi Exception `NameError' at ./../config/boot.rb:14 - uninitialized constant Rails /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/validations.rb:334: warning: `*' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/validations.rb:363: warning: `*' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:224: warning: instance variable @ignore_new_methods not initialized /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:224: warning: instance variable @ignore_new_methods not initialized /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:41: warning: method redefined; discarding old allow_concurrency= /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/sqlserver_adapter.rb:456: warning: method redefined; discarding old remove_column Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- db2/db2cli Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- db2/db2cli Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- db2/db2cli /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/oracle_adapter.rb:119: warning: (...) interpreted as grouped expression Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- oci8 Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- oci8 Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- oci8 Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- oci8 Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- oci8 Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- oci8 Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/kernel/requires.rb:19 - no such file to load -- oci8 Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- sybsql Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- sybsql Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- sybsql /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/request.rb:169: warning: method redefined; discarding old relative_url_root Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- Win32API Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- Win32API Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- Win32API /usr/lib/ruby/1.8/cgi/session/pstore.rb:17: warning: method redefined; discarding old []= /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/cgi_ext/raw_post_data_fix.rb:57: warning: ambiguous first argument; put parentheses or even spaces /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/cgi_ext/raw_post_data_fix.rb:8: warning: method redefined; discarding old initialize_query Exception `DRb::DRbServerNotFound' at /usr/lib/ruby/1.8/drb/drb.rb:1647 - DRb::DRbServerNotFound Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- memcache Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- memcache Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- memcache /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session/active_record_store.rb:129: warning: private attribute? /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session/active_record_store.rb:179: warning: method redefined; discarding old connection Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- redcloth Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- redcloth Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- redcloth Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- redcloth Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- redcloth Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- redcloth Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/kernel/requires.rb:19 - no such file to load -- redcloth Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- bluecloth Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- bluecloth Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- bluecloth Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- bluecloth Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- bluecloth Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- bluecloth Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/kernel/requires.rb:19 - no such file to load -- bluecloth Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- html/tokenizer Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- html/tokenizer Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- html/tokenizer /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/helpers/prototype_helper.rb:640: warning: ambiguous first argument; put parentheses or even spaces /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/helpers/prototype_helper.rb:873: warning: `*' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/actionmailer-1.2.1/lib/action_mailer/vendor/tmail/facade.rb:486: warning: method redefined; discarding old create_reply Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- tmail/base64.so Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- tmail/base64.so Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- tmail/base64.so Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- tmail/scanner_c.so Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- tmail/scanner_c.so Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- tmail/scanner_c.so Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- xml/parser Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- xml/parser Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- xml/parser Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- xml/parser Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- xml/parser Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- xmlscan/scanner Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- xmlscan/scanner Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- xmlscan/scanner Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- xmlscan/scanner Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- xmlscan/scanner Set XSD::XMLParser::REXMLParser as XML processor. Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21 - no such file to load -- http-access2 Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- http-access2 Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:150 - no such file to load -- http-access2 Loading http-access2 failed. Net/http is used. /usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/protocol/xmlrpc_protocol.rb:6: warning: discarding old message /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/initializer.rb:581: warning: method redefined; discarding old []= /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/initializer.rb:590: warning: method redefined; discarding old [] /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/initializer.rb:595: warning: method redefined; discarding old keys /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/initializer.rb:600: warning: method redefined; discarding old find_pair /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/initializer.rb:607: warning: method redefined; discarding old []= /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/initializer.rb:611: warning: method redefined; discarding old [] /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/initializer.rb:615: warning: method redefined; discarding old method_missing /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/initializer.rb:483: warning: instance variable @after_initialize_block not initialized Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/i686-linux/fcgi.so:0 - libfcgi.so.0: cannot open shared object file: No such file or directory - /usr/lib/ruby/site_ruby/1.8/i686-linux/fcgi.so Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.8/fcgi.rb:593 - undefined method `is_cgi?' for FCGI:Class (eval):3: warning: redefine remove_params (eval):13: warning: method redefined; discarding old initialize (eval):19: warning: method redefined; discarding old args (eval):22: warning: method redefined; discarding old env_table (eval):25: warning: method redefined; discarding old stdinput (eval):28: warning: method redefined; discarding old stdoutput Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.8/fcgi.rb:593 - undefined method `is_cgi?' for FCGI:Class linuxserver public #

Is there anything I’m missing? Thank you for any help you can provide!

I am having the exact same problem - were you able to find a solution?

Jeff Dean wrote:

I am having the exact same problem - were you able to find a solution?

This command fix this problem for me. I don’t know, this is good
solution, bud works.

chmod -Rcv 777 /your_rails_app

Thanks for that - I tried it and it still doesn’t work.

I also tried giving similar permissions to the other directories related
to rails (the ruby directory, directories that hold the fcgi/fcgid files
etc…) and still nothing.