in reply to Premature End of Script Headers
In an answer only *slightly* related to what you're asking about, you should be able to gleen some sort of clue as to what is happening form your web server error logs, assuming you have access to them. The logs should show you the output that the script produced prior to the headers that resulted in the "premature end of script headers" message.