# Apache & FCGI: Premature end of script headers:

**URL:** <https://www.ruby-forum.com/t/apache-fcgi-premature-end-of-script-headers/65058>\
**Category:** Rails\
**Created:** [August 15, 2006, 10:25pm UTC](https://www.ruby-forum.com/t/apache-fcgi-premature-end-of-script-headers/65058 "2006-08-15T22:25:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cneuhaus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/34f0e0/32.png) [@cneuhaus](https://www.ruby-forum.com/u/cneuhaus)\
**Post date:** [August 15, 2006, 10:25pm UTC](https://www.ruby-forum.com/t/apache-fcgi-premature-end-of-script-headers/65058/1 "2006-08-15T22:25:38Z")

</div>

Hi,  
I have quite a problem right now. After finish of development I  
installed rails with fcgi and apache on my production env. Everything  
seems to be configured ok, but once I while I get the famous error  
message:  
" Premature end of script headers: dispatch.fcgi"

I cant see any generel configuration problem, as sometimes everything is  
running fine.

Maybe it is a problem related to timing:

 AddHandler fcgid-script .fcgi SocketPath /var/lib/apache2/fcgid/sock DefaultInitEnv RAILS\_ENV production IPCCommTimeout 50 IPCConnectTimeout 50 MaxProcessCount 40 ProcessLifeTime 86400 IdleTimeout 80 DefaultMaxClassProcessCount 8

Dispatch.fcgi is running fine if I start direct from command line with  
the following message (ignore the warning - I have to clean this up):

…/config/…/vendor/date.rb:3: warning: already initialized constant  
MONTHNAMES  
…/config/…/app/helpers/account\_helper.rb:56: warning: don’t put space  
before argument parentheses  
…/config/…/app/helpers/account\_helper.rb:57: warning: don’t put space  
before argument parentheses  
…/config/…/app/controllers/application.rb:27: warning: already  
initialized constant EventRepType  
Status: 500 Internal Server Error  
Content-Type: text/html

# Application error

Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code) in public/500.html

Any help would be very much appreciated !

Regards  
Christian

---

<div class="post-metadata">

**Author:** ![cneuhaus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/34f0e0/32.png) [@cneuhaus](https://www.ruby-forum.com/u/cneuhaus)\
**Post date:** [August 16, 2006, 12:00am UTC](https://www.ruby-forum.com/t/apache-fcgi-premature-end-of-script-headers/65058/2 "2006-08-16T00:00:59Z")

</div>

Christian,  
My sincere advice. Dump Apache & FCGI and move to Lighttpd w/  
SCGI  
or Mongrel. Lighttpd w/ SCGI is a breeze to install and you wont regret  
it.  
I moved over after facing stupid FCGI errors which were not even  
consistent!

[http://wiki.rubyonrails.org/rails/pages/HowToDeployWithLighttpdOnWindows](http://wiki.rubyonrails.org/rails/pages/HowToDeployWithLighttpdOnWindows)

I am assuming that you are trying this out on windows

Regards,  
Navin Samuel

---

<div class="post-metadata">

**Author:** ![cneuhaus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/34f0e0/32.png) [@cneuhaus](https://www.ruby-forum.com/u/cneuhaus)\
**Post date:** [August 17, 2006, 9:38am UTC](https://www.ruby-forum.com/t/apache-fcgi-premature-end-of-script-headers/65058/3 "2006-08-17T09:38:05Z")

</div>

Hi Navin,  
thanks for your information. I am running my v-server on Debian with  
Apache2. As the server is sometimes running fine and really fast I  
wanted keep my installation when possible. But if I cant find a solution  
here, I will surely think about your suggestion and post the result  
here.

If (in the meanwhile) anybody had similar experience with Apache &  
FastCGI - and solved it please let me know 🙂

Regards,  
Christian
