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
Recommended Help Content
My Ruby on Rails installation keeps displaying a '404 Not Found' error.
What Ruby on Rails version and Gems are installed?
How do I setup Ruby on Rails?
Knowledgebase Article
403,785 views
tags:
rails ruby
Related Help Content
How to install Redmine a Ruby on Rails application
How do I install my own Ruby Gems?
Rails Troubleshooting!
Knowledgebase Article
107,990 views
tags:
rails
What is the path to Ruby?
Knowledgebase Article
172,171 views
tags:
path ruby
Look for the error message that most closely matches the one you received.
Knowledgebase Article
198,642 views
tags:
email error
Does your company have any limit about CGI script use?
Knowledgebase Article
271,286 views
tags:
cgi script
Website shows a server 500 error, what can I do to fix it?
Knowledgebase Article
720,535 views
tags:
error
How do I use .html files to run SSI (Server Side Includes)?