Re: Dreaded Premature end of script headers
| From: | tamouse mailing lists | Date: | Fri, 26 Aug 2011 18:01:31 +0000 |
| Subject: | Re: Dreaded Premature end of script headers | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314622@lists.php.net to get a copy of this message | ||
On Fri, Aug 26, 2011 at 2:17 AM, Кирилл <bestestmail@gmail.com> wrote:
> Actually i think you outputing something in script, before you use headers -
> there are several solutions:
> 1)make your headers functions at the top of your script
> 2)if there is no any output - you should look for invisible characters like
> BOM or new line
> 3)use ob_start() at the beginning and ob_end_flush() at the end - it will
> buffer all output
> P.S. If i wanna know what headers come from script i use these steps at
> Chrome push combination (ctrl + shift + j) click on Network tab, reload
> page, find something with the name of your page click on it, and see script
> headers at headers tab
That's what I thought as well, however, the script itself doesn't emit
any headers. And usually, if output is send before a script emits
headers, you get an entirely different error. Under normal
circumstances, the script just outputs a couple of lines to show
status. This script is run as a cron job nightly and the output is
just appended to a log. What's getting appended instead is a 500 error
message. If i run the script with debugging enabled (which will emit a
whole lot of output), the premature end of script headers error
doesn't occur.