shambright has asked for the wisdom of the Perl Monks concerning the following question:

My 'error_log' is clogged by 'error reading the headers' from a script written to collect form information. The information is processed, stored in MySQL, and an appropriate 'Thank you' issued.

The script runs correctly without issues from '-w', so I won't post it unless necessary.

Is this a timeout problem? Is this even a Perl question?

Replies are listed 'Best First'.
Premature End of Script Headers (was: Re: Newbie error management question) (code)
by deprecated (Priest) on May 13, 2001 at 00:00 UTC
    Assuming this is your httpd error_log, this is a 500 error, and you can probably fix it by adding:
    use CGI::Carp qw{ fatalsToBrowser }; # credit to Kanji for this fix...
    to the top of your script. No, I dont think its a timeout problem. It means your headers were malformed. It took me a while to learn that I actually had to print out HTML headers from a cgi, like so:
    print start_html, #foo...
    You'll also find hints in the apache manual that came with your server. And zillions of returns in google.

    brother dep

    --
    Laziness, Impatience, Hubris, and Generosity.

      Security note: only use fatalsToBrowser in pre-production code. It returns error messages that could be helpful to crackers!

      (I know deprecated knows that, I just wanted to make it absolutely clear to any folk not in the know who happen on this post later))

      perl -e 'print "How sweet does a rose smell? "; chomp $n = <STDIN>; $r +ose = "smells sweet to degree $n"; *other_name = *rose; print "$other +_name\n"'
      thanks for the suggestion. Can you unstick me from this next one, too? What is the difference between printing headers immediately (as you suggested) and using

      $|=1;

      to flush the buffers. I thought that this would send the headers (?). Also, if I have a script that takes awhile to run (e.g. complex MySQL statements), sometimes the browser times out. IS there a way to let the browser know "Hold on... I'm coming with your answer" ?

        Glad I could be of help.

        I can't really help without seeing your script. $|++ doesnt really "flush the buffers" as much as it tells perl not to hold buffers. I'm happy to offer help, but I cant see what's going wrong with your code without, er, seeing whats wrong with your code. :)

        brother dep.

        --
        Laziness, Impatience, Hubris, and Generosity.