dynamic PNG image generation

[email protected] ("rjae") Sun, 2 Sep 2001 14:17:09 -0400
Newsgroups php.lang
Message-ID <[email protected]>
hi

I am using PHP4.0.4 to dynamically generate a PNG image with code
like

<?
126   header ("Content-type: image/png");
127  $im = ImageCreate(50,100);
 ..
 ..
 ..
201   ImagePNG($im);
?>

This code is embed in HTML file. The number on right are lines numbers just
for reference.
I got error

"Cannot add  header information -- header already sent by
/var/www/html/php4/physics_01.php4
on line 126."

appears apache server is parsing the output and return this error message in
response to find "header
information generated by line 126. I have 2 questions


1. Is there a way to test script outside apache -- without a  web server
running.
2. Is this an apache configuration problem? I am using the default
configuration which
    works fine for mime type  text/html.

Thanks for your help.
[email protected]