Error 500: Premature end of script headers

前端 未结 15 1491
臣服心动
臣服心动 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条回答
  •  旧时难觅i
    2020-12-01 14:45

    I experienced this problem today, but unfortunately none of the suggestions here helped. The only problem was that I didn't see ANY errors.. I literally had to do an strace -p on the Apache thread to spot the headers being written and Apache crashing on the next line; Somewhere in my PHP code I was setting a header with over 12KB of data.

    The lesson here is that in some cases, Apache crashing with a HTTP error 500 - Premature end of script-failure can be the result of having too long or overflowing HTTP headers.

    Debug your headers for length if you have this same problems because most (if not all) web servers have HTTP header limits.

    PS: This reply has some info on header sizes.

提交回复
热议问题