php inserts HEX number of characters before the content

后端 未结 3 539
無奈伤痛
無奈伤痛 2020-12-21 10:42

I\'m moving a website to a new server. (Old server had php 5.3.2, the new one has php 5.5.9) Centos, httpd Apache/2.2.26.

I\'ve copied files and it works fine except

3条回答
  •  失恋的感觉
    2020-12-21 10:55

    Had this problem for serving HTML as well as plain text. EXPLICITLY setting header Transfer-Encoding to "chunked"

    header("Transfer-Encoding: chunked");
    

    indeed solved the problem (not sure how reliably though). That Transfer-Encoding header was being added automatically even if i didn't set it - but the problem was still there. Setting the header explicitly in PHP code solved it, but not exactly - see below. Tested using websniffer.cc, PHP 7.4.9, CentOS 7.8

    UPDATE: adding the header might confuse some clients. https://securityheaders.com/ failed to connect to the site with this header explicitly set on (regardless of content length)

提交回复
热议问题