Apache Web-Serving With Mac OS X, Part 5
Subject:   still having trouble with cgi
Date:   2002-03-19 14:10:32
From:   morbus
Response to: still having trouble with cgi

You say the perldiver.cgi script outputs good HTML on the command line - but, but, but, when run as a CGI, it absolutely *needs* to output:

"Content-type: text/html\n\n"

before, before, before any other output to the browser. If you do not output that text, then the browser has no flipping clue what data is coming to it, so it will return an error) about premature script headers.

Generically though, "premature script headers" could be any number of problems, only one of which could be missing that Content-type line. To further debug your problem, check out the various documents at Debugging Perl - (but be prepared for tons of popup advertisements).