Error 500: Premature end of script headers

前端 未结 15 1482
臣服心动
臣服心动 2020-12-01 14:31

I get a \"Premature end of script headers: contactform.cgi\" error message when running the below script. What frustrates me is that I ran this as a .php on another server

15条回答
  •  臣服心动
    2020-12-01 14:56

    The "Premature end of script headers" error message is probably the most loathed and common error message you'll find. What the error actually means, is that the script stopped for whatever reason before it returned any output to the web server. A common cause of this for script writers is to fail to set a content type before printing output code. In Perl for example, before printing any HTML it is necessary to tell the Perl script to set the content type to text/html, this is done by sending a header, like so:

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

    (source; http://htmlfixit.com/cgi-tutes/tutorial_Common_Web_dev_error_messages_and_what_they_mean.php#premature

提交回复
热议问题