Apache & FCGI: Premature end of script headers:

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
" 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
…/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 !


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


I am assuming that you are trying this out on windows

Navin Samuel

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

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


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs