I have PHP installed on my machine (currently windows one, but question applies to Linux one too). When I run a script via PHP as CGI, I get an Apache error ("Internal server error") and errors in the Apache logfiles ("Premature end of script headers"). When I run the same script with PHP as Apache module I get (as I prefer) the PHP errors ("Warning ... "). Of course, this is what I want - I want to be able to do some debugging on my script.
How come (and more important : how to prevent) Apache sends this error ? How come PHP as CGI doesn't generate the correct headers first ?