# Dispatch.cgi Problem

**URL:** <https://www.ruby-forum.com/t/dispatch-cgi-problem/53236>\
**Category:** Rails\
**Created:** [January 30, 2006, 5:39am UTC](https://www.ruby-forum.com/t/dispatch-cgi-problem/53236 "2006-01-30T05:39:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://www.ruby-forum.com/u/eric)\
**Post date:** [January 30, 2006, 5:39am UTC](https://www.ruby-forum.com/t/dispatch-cgi-problem/53236/1 "2006-01-30T05:39:24Z")

</div>

Hey all,

I’ve been battling with ruby configurations for days now…trying to get  
either SCGI or FCGI to work on my Apache 1.3/Linux Red Hat 3 server.

I’ve pretty much gave up that battle since either of them will work with  
me after trying dozens of configurations, but now even when I try to run  
apps with dispatch.cgi I get this error in my log: “Premature end of  
script headers: /home/mysite/mydir/rubyapp/public.dispatch.cgi”

I’ve double checked my chomd on dispatch.cgi, etc… (which is 755), my  
shebang line is correct, my .htaccess is perfect, i dont get it.

I can code a full functional ruby app in 30 minutes, but then spend  
about 3 days figuring out how to deploy it :-/

Any help would be much appreciated!

---

<div class="post-metadata">

**Author:** ![eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://www.ruby-forum.com/u/eric)\
**Post date:** [January 30, 2006, 12:13pm UTC](https://www.ruby-forum.com/t/dispatch-cgi-problem/53236/2 "2006-01-30T12:13:34Z")

</div>

Eric wrote:

> I’ve been battling with ruby configurations for days now…trying to get  
> either SCGI or FCGI to work on my Apache 1.3/Linux Red Hat 3 server.
> 
> I’ve pretty much gave up that battle since either of them will work with  
> me after trying dozens of configurations, but now even when I try to run  
> apps with dispatch.cgi I get this error in my log: “Premature end of  
> script headers: /home/mysite/mydir/rubyapp/public.dispatch.cgi”

When I had the same problem it was due to a different UID not being  
able to read the old sessions in /tmp. Try deleting them.

Are you getting anything in your Rails log?

–  
We develop, watch us RoR, in numbers too big to ignore.

---

<div class="post-metadata">

**Author:** ![eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://www.ruby-forum.com/u/eric)\
**Post date:** [January 30, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/dispatch-cgi-problem/53236/3 "2006-01-30T14:02:09Z")

</div>

same story here, but I finally got mine up and running. What do you  
get when you request the file at the command line? Likely a 500  
errror, but it may also tell you wha the issue is.

On 1/30/06, Mark Reginald J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> When I had the same problem it was due to a different UID not being  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
[http://brantinteractive.com](http://brantinteractive.com)  
removed\_email\_address@domain.invalid  
4034 skippack pike  
v. 267.640.2195  
f. 215.689.1454

---

<div class="post-metadata">

**Author:** ![eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://www.ruby-forum.com/u/eric)\
**Post date:** [February 16, 2006, 6:51am UTC](https://www.ruby-forum.com/t/dispatch-cgi-problem/53236/4 "2006-02-16T06:51:32Z")

</div>

My problem was that the dispatch wasn’t getting the

require ‘fcgi\_handler’

so I had to hand copy this from my rails gem directory to the apps lib/  
directory and it all worked. Obviously not the best solution, but this  
was the root of the problems.

Andrew

> **[High Earth Orbit](https://highearthorbit.com/)**
>
> Personal website of Andrew Turner. Writings on geospatial collaboration, software engineering, Washington D.C., and other individual musings.

---

<div class="post-metadata">

**Author:** ![eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://www.ruby-forum.com/u/eric)\
**Post date:** [January 30, 2006, 5:46pm UTC](https://www.ruby-forum.com/t/dispatch-cgi-problem/53236/5 "2006-01-30T17:46:09Z")

</div>

Rich B. wrote:

> same story here, but I finally got mine up and running. What do you  
> get when you request the file at the command line? Likely a 500  
> errror, but it may also tell you wha the issue is.
> 
> On 1/30/06, Mark Reginald J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > When I had the same problem it was due to a different UID not being  
> > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> 
> –  
> [http://brantinteractive.com](http://brantinteractive.com)  
> removed\_email\_address@domain.invalid  
> 4034 skippack pike  
> v. 267.640.2195  
> f. 215.689.1454

No luck, deleted my /tmp ruby files and ran dispatch from command line,  
got a 500 Server Error, also not getting anything in Rails log.

Have no clue what it could be, after a triple check, everything seems  
configured properly, do I have any other options?
