使用IIS禁用单个php文件的Gzip压缩


Disable Gzip compression for single php file with IIS

我有一个配置,似乎不太常见的互联网(PHP与IIS),到目前为止,我还没有能够找到解决我的问题,因为这个。

基本上当我在php页面上发送手动404标头时:

header('HTTP/1.0 404 Not Found');

问题是我总是得到编码错误,我确定这与启用gzip有关。

当我用——compressed旋转时,我得到:

HTTP/1.1 404 Not Found
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 3560
Content-Type: text/html
Content-Encoding: gzip
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Vary: Accept-Encoding
Server: Microsoft-IIS/6.0
Set-Cookie: PHPSESSID=b0ueqhtc3o4p7m2luqss170fr3; path=/
Date: Mon, 11 Jul 2011 16:15:40 GMT
curl: (61) Error while processing content unencoding: invalid code lengths set

是否可以仅为这一页禁用压缩?或者还有其他的解我漏掉了?我不想禁用整个站点的压缩

这很简单,只需像这样使用ini集:

<?php 
    if(ini_get('zlib.output_compression')){ 
        ini_set('zlib.output_compression', 'Off'); 
    }
    header('HTTP/1.0 404 Not Found');
?>

就是这么简单。