[ILUG-BOM] Image Support with PHP
Wed Sep 4 18:28:55 IST 2002
On Tue, 03 Sep 2002 kapil_karekar at vsnl.net wrote :
>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().
More information about the Linuxers