in reply to What causes 'premature end of script headers'?
You might have a bug in your code.
will throw errors up to the browser.
You can also run cgi scripts from the command line to check they actually run.