Application Error - Rails application failed to start properly
This is a wiki article created by HostingRails users. Please login or signup to make edits.
If you're getting this error and don't like it, here's what to check & fix:
- Shebang line in your dispatchers - make sure the top line in your public folder's dispatch.fcgi and dispatch.rb read
#!/usr/local/bin/ruby
- Permissions !!! - make sure to
and make sure your public folder is 755, too[~/railsapp/public]# chmod 755 dispatch.*
- Production Mode - uncomment ENV['RAILS_ENV'] ||= 'production' in your environment.rb
- Typos - double check that your .htaccess and environment.rb files don't contain any typos. Go to your public/ directory and execute ./dispatch.fcgi or ./dispatch.cgi to check if there are coding mistakes.
- RAILS_GEM_VERSION - set this in your environment.rb to a version that is either installed on the server or frozen in your app.
- Gems and Plugins!! - Make sure your gems and plugins are installed on the server and preferably frozen in your app. If one is missing or a version is different on the sever than what you developed on, this can be a problem.
- No Puts!! - Apache doesn't play nice with puts calls in your code.
- database.yml - Make sure you have created a database, assigned a user, and have the correct login info in your config/database.yml file. Also, make sure that your database adapter (ex. adapter: mysql) is included for Rails 2.0 apps.
- RewriteRules - In your .htaccess, don't mess with the order of the rewrite rules that Rails creates automatically. You should change the .cgi to .fcgi, yes - but keep in mind that the order of lines is important. We've seen people put the dispatch.fcgi line far up in the file and they wonder why their static files (images, css, etc..) aren't being served. (i.e. all requests are going to the dispacher, when static files shouldn't be!)
On rare occasions we've seen custom activity in the environment.rb that worked locally but not online. This is usually because people do not develop with FastCGI.
If you're just seeing a 500 Application error without the "failed to start" bit --- then check your production.log -- that will tell you a lot more about what's going on. If what is says there confuses you, post it in the "Deployment Troubleshooting Forum"
"
William
Bilson