[Wolves] headers already sent php

Chris Ellis chris at intrbiz.com
Thu Dec 12 14:11:09 UTC 2013


Hi Wayne

On Thu, Dec 12, 2013 at 1:57 PM, Wayne <waynelists at machx.co.uk> wrote:

> Since i moved servers I seem to get error after error with 'headers
> already sent' in php
> (on Adams server seemed like I could construct any old rubbish and it
> would display correctly.
>

The 'headers already sent' error is caused by something being written to
the output stream before you are adding a header.  Once
the output stream has been written to, the headers have already been
flushed to the client, as such you cannot alter them.

In PHP, this is usually caused by *ANY* white space or text before the
<?php of your script.  The solution to enabling sending headers
after writing to the output stream is buffering, IIRC this can be enabled
at the server level.  It can also be enabled in your script, using:

<?php ob_start(); ?>

Make sure that is the *FIRST* thing in your script and see if that helps.

Have a read of:
http://stackoverflow.com/questions/8028957/headers-already-sent-by-php

Regards,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/wolves/attachments/20131212/8c3fc944/attachment.html>


More information about the Wolves mailing list