Bluehost Web Hosting Help

Ruby on Rails application generates a 500 - Premature end of script error

Problem:

When I attempt to execute my Ruby on Rails application I receive "500- Premature end of script."

Solution:

This error generally has two potential causes:

  • The file permissions are not set to allow the dispatch.cgi to execute properly.

    Chmod the dispatch.cgi to 0755.

  • The path to Ruby is is incorrect in the dispatch.cgi file.

    The first line of the file is called the hashbang-- it sets the location of the interpreter (in this case ruby).

    Change the hashbang to the correct path to Ruby (/usr/bin/ruby).
    The first line of the dispatch.cgi file should look like this:
    #!/usr/bin/ruby

Knowledgebase Article 158,898 views bookmark tags: premature rails ruby script


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

Ruby on Rails 404 Errors

My Ruby on Rails installation keeps displaying a '404 Not Found' error.

Ruby on Rails, Gems

What Ruby on Rails version and Gems are installed?

Ruby on Rails Setup

How do I setup Ruby on Rails?

Related Help Content

Ruby on Rails: How-to install Redmine

How to install Redmine a Ruby on Rails application

Ruby Gems Installation

How do I install my own Ruby Gems?

Rails Troubleshooting

Rails Troubleshooting!

Path to Ruby

What is the path to Ruby?

Email Error Messages - What Do They Mean?

Look for the error message that most closely matches the one you received.

CGI Script Limitations

Does your company have any limit about CGI script use?

What Is A 500 Internal Server Error? How To Fix 500 Internal Server Error

Website shows a server 500 error, what can I do to fix it?

Server Side Includes SSI

How do I use .html files to run SSI (Server Side Includes)?