"Premature end of headers" (or something to that effect) is what the browser reports if upon attempting to invoke your script, something got printed before a proper CGI header was printed.

What got printed prior to the headers could be any of the following:

...and I'm probably missing a few possibilities.

You should check the following:

  1. Check the server's error log to see if it contains any hints. It probably will.
  2. Check the script's permissions and path, and the permissions and paths of any files the script needs to be able to access.
  3. Check that the script runs as expected from the command line. This will tell you if you have any compiletime or runtime errors, aside from errors that might only turn up when the script is run as 'nobody' (or whatever 'person' your webserver assumes). If the script uses CGI (as it probably should), running it from the commandline is easily done.
  4. Check to ensure that any use of relative paths is resolving to where you think it is.
  5. Make sure that if the script was carried from one operating system environment, to a different operating system, its line endings were converted. Common utilities for this are "dos2unix" and "unix2dos", or ASCII mode for your (hopefully) properly configured FTP client.
  6. Start debugging the script itself, following its logic to see if some sequence of events is causing it to print something else prior to the headers.

Ultimately your problem is probably a product of the CGI and Operating System environments, and probably not really a Perl-related issue.


Dave


In reply to Re: Configuration Problems by davido
in thread Configuration Problems by rjahrman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.