# SOS. How can I use dispatch.cgi from command line?

**URL:** <https://www.ruby-forum.com/t/sos-how-can-i-use-dispatch-cgi-from-command-line/142862>\
**Category:** Rails\
**Created:** [July 12, 2008, 8:18am UTC](https://www.ruby-forum.com/t/sos-how-can-i-use-dispatch-cgi-from-command-line/142862 "2008-07-12T08:18:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [July 12, 2008, 8:18am UTC](https://www.ruby-forum.com/t/sos-how-can-i-use-dispatch-cgi-from-command-line/142862/1 "2008-07-12T08:18:23Z")

</div>

Hi,

Arrgg. I’m getting nasty Premature end of script headers: dispatch.cgi,  
referer: [http://www.myapp.com](http://www.myapp.com)

If I go to [http://www.myapp.com](http://www.myapp.com) I can get to the main page perfectly.  
But when I try to get to the login page [http://www.myapp.com/login](http://www.myapp.com/login) then  
I get the errors (this has been working fine before…)

Running dispatch.cgi from command line should give more info I think.

How do I use dispatch.cgi from command line so it goes to the  
[http://www.myapp.com/login](http://www.myapp.com/login) to find some errors?

SOS

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [July 12, 2008, 8:50am UTC](https://www.ruby-forum.com/t/sos-how-can-i-use-dispatch-cgi-from-command-line/142862/2 "2008-07-12T08:50:38Z")

</div>

I modified the routes to get to the login page. I got:

[myspapp.com](http://myspapp.com) [~/rails/theapp/public]# ./dispatch.cgi  
/home/mine/rails/theapp/app/views/session/new.html.erb:1: warning: don’t  
put space before argument parentheses  
Segmentation fault

* * *

Hmm. Segmentation fault. Whatever that means.

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [July 12, 2008, 9:24am UTC](https://www.ruby-forum.com/t/sos-how-can-i-use-dispatch-cgi-from-command-line/142862/3 "2008-07-12T09:24:38Z")

</div>

On Jul 12, 7:50 am, comopasta Gr [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I modified the routes to get to the login page. I got:
> 
> [myspapp.com](http://myspapp.com) [~/rails/theapp/public]# ./dispatch.cgi  
> /home/mine/rails/theapp/app/views/session/new.html.erb:1: warning: don’t  
> put space before argument parentheses  
> Segmentation fault
> 
> * * *
> 
> Hmm. Segmentation fault. Whatever that means.

That means the ruby interpreter is borked and crashed. The currently  
available version of ruby 1.8.6 (patch level 230) is known to do  
that . If you want to run dispatch.cgi by hand then you’ll have to set  
up all the stuff that the webserver would ie all the environment  
variables and so on).

Fred

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [July 12, 2008, 12:03pm UTC](https://www.ruby-forum.com/t/sos-how-can-i-use-dispatch-cgi-from-command-line/142862/4 "2008-07-12T12:03:46Z")

</div>

Btw. We can freeze the Rails gems but that is not including Ruby I  
guess.  
Is there a way to prevent these problems when someone goes and upgrades  
Ruby?

Cheers.

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [July 12, 2008, 12:00pm UTC](https://www.ruby-forum.com/t/sos-how-can-i-use-dispatch-cgi-from-command-line/142862/5 "2008-07-12T12:00:45Z")

</div>

Thanks Fred, you are always around \O/

> > The currently available version of ruby 1.8.6 (patch level 230) is known to \>\> do that

And that patch level is exactly the same that Bluehost is having  
currently 8-P  
In my case the forms are the problem. If I remove the form then that  
page at least works. This I use:

\<% form\_tag session\_path do -%\>  
Username\<%= text\_field\_tag ‘login’ %\>  
Password\<%= password\_field\_tag  
‘password’ %\>  
\<%= submit\_tag “log in” %\>  
\<%= link\_to ‘Sign up’, signup\_url %\>  
  
  
  
\<% end -%\>  
  
  
\<%= link\_to ‘Forgot password?’, forgot\_password\_url %\>

I’m not sure is there a workaround…

Cheers.

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [July 12, 2008, 8:58pm UTC](https://www.ruby-forum.com/t/sos-how-can-i-use-dispatch-cgi-from-command-line/142862/6 "2008-07-12T20:58:46Z")

</div>

On Jul 12, 11:03 am, comopasta Gr [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Btw. We can freeze the Rails gems but that is not including Ruby I  
> guess.  
> Is there a way to prevent these problems when someone goes and upgrades  
> Ruby?

Not that I know off. Your host should know better than to upgrade to a  
known bad version of ruby.

Fred

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [July 12, 2008, 9:42pm UTC](https://www.ruby-forum.com/t/sos-how-can-i-use-dispatch-cgi-from-command-line/142862/7 "2008-07-12T21:42:25Z")

</div>

> Not that I know off. Your host should know better than to upgrade to a  
> known bad version of ruby.

Just heard it might take one week ☹

Thanks Fred.
