Re: "premature end of header" script error



On Nov 29, 11:44 am, jainan...@xxxxxxxxx (Ankur) wrote:
Hi,

I am receiving the following error : "Premature end of script headers"
when running my CGI script using a web browser.

Instead if I execute the script manually at the shell, it executes
successfully. Actually, the script needs to fetch a lot of data from
the database.

I couldn't find any related reference for this error description on
the web, though there are a lot of other references.

This has nothing to do with Perl and everything to do with CGI
programming.

My guess you forgot to print the HTTP Header. You're claiming it
"works" on the command line, because you saw your HTML output appear
in the console window. But did you also see something that looks
like:
Content-Type: text/html; charset=ISO-8859-1

If not, you've forgotten to print the header. If you're using the CGI
module (and if you're not, you should be), just stick this line before
any of your print statements:
print header;

Paul Lalli

.



Relevant Pages

  • Re: [SLE] Down load count?
    ... >> and have the CGI generate a redirect to the actual PDF. ... > You can serve a stream of bytes through a php script. ... if you specify an attachment name in the header, ...
    (SuSE)
  • Re: CGI::Carp die with status
    ... A simple CGI example script is: ... die "Some error occured...\n"; ... I would like the status header not to print 200 OK, ... status header when the script dies with fatalsToBrowser as above. ...
    (comp.lang.perl.misc)
  • Re: PHP under CGI Directory
    ... > PHP as CGI - I always run it as an Apache module. ... > presence of a shebang and running as CGI means you cannot send headers? ... This is an excerpt of my script. ... I moved the header function call to the very top of my script ...
    (comp.lang.php)
  • Re: Problem with ASP on Webserver
    ... There is no ActiveX object involved in this problem, we only request a ASP ... function in the script ... (Accept-Language:) ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Problem with ASP on Webserver
    ... There is no ActiveX object involved in this problem, we only request a ASP ... function in the script ... (Accept-Language:) ...
    (microsoft.public.windowsce.platbuilder)