in reply to Premature end of script headers?

You will be generating an error in your code, somehow. To see what is causing the problem add these lines:

#!/usr/bin/perl -w ensure all fatals go to browser during debugging and setup comment these 3 lines out on production code for security $|=1; print "Content-type: text/html\n\n"; use CGI::Carp('fatalsToBrowser');

These lines need to go at the top - no if ands buts or maybes.

They will force the error to print in the browser window for you.

The $|=1; forces buffer flushing. We then print a valid complete header and then add CGI::Carp. Together very few errors will not appear in the browser window with these active. Some 500s still sneak through on rare occasions but this usually does the trick.

hope this reveals your problem

cheers

tachyon

Replies are listed 'Best First'.
Re: Re: Premature end of script headers?
by MrCromeDome (Deacon) on Jun 21, 2001 at 22:47 UTC
    I added those lines exactly as you wrote them. The results were bizarre and unexpected, but now, for whatever reason, it works :) In what way were they bizarre and unexpected? I added those lines, changed nothing else, and for whatever reason, the code works. No warnings are shown to the browser or to the server logs.

    I also didn't know that CGI::Carp was available for ActivePerl.

    Thanks for your help!
    MrCromeDome

      In what way were they bizarre and unexpected? I added those lines, changed nothing else, and for whatever reason, the code works.

      In the fall of 1980, I took some computer courses at USL. There was a program called PPOM that acurately predicted the amount of time to retrieve a printout and the amount of bugs a program would encounter.

      If PPOM had a high score, you could pretty much give up on fixing your program. Often the very same code would run error free the next day. (The same thing occurs today when I restart windows.)


      What does PPOM stand for?
      Print Phases Of the Moon
      Go figure!

      Enjoy,
      Charles K. Clarkson

      Look in the top left hand corner of the browser window. Whant *must* have changed is that your script was emitting some noise on STDOUT prior to the "Content-Type: text/html\n\n" header. Anyway glad it worked!

      Cheers

      tachyon