On Tue, 03 Sep 2002 kapil_karekar@vsnl.net wrote :
Hi guys,
I am having an issue with generating images using PHP.
When I include the PHP file(ex. graph.php), which generates the PNG image, in my current html file, it gives an error saying "Headers already sent.
* snip *
Ahhh, see I'll make it sound simple - before any HTML is sent to the browser, the server dishes out headers to it. The 'Content-Type' and Content-Size is one example, cookies are another. However this process only happens once, that is to say you cannot send headers after you've sent the browser HTML.
So do your includes _before_ sending HTML and do not print or echo anything in the includes unless you obviously can't do with out it. Also for debugging, set variables rather than using die().
Regards,
-ah.
On Wed, Sep 04, 2002 at 12:50:01PM -0000, Amol Hatwar wrote:
Ahhh, see I'll make it sound simple - before any HTML is sent to the browser, the server dishes out headers to it. The 'Content-Type' and Content-Size is one example, cookies are another. However this process only happens once, that is to say you cannot send headers after you've sent the browser HTML.
So do your includes _before_ sending HTML and do not print or echo anything in the includes unless you obviously can't do with out it. Also for debugging, set variables rather than using die().
Not too sure about this, but iirc, this changes with the newer version of PHP.
Output is buffered, so you can have headers anywhere.
Need to confirm though.