【问题标题】:php error compression mod_deflate gzip compressionphp 错误压缩 mod_deflate gzip 压缩
【发布时间】:2014-01-06 06:17:27
【问题描述】:

我按照这种方式compression 1compression 2

如何使用 mod_deflate 进行压缩?我已经按照上面的链接并成功压缩但浏览器无法读取压缩? 在浏览器中打开 css 和 js 文件时出现错误!

语法错误:非法字符

��{{�F�7���"ƫ

KÊO©¬NJLÎN/Ê/ÍKÑMÎÏÉ/²RN2H6II�ó>å¿rŸ—Ï9?ýSúg½/úž;RSŸ'‡™§çZV†¤ü”Êê¤Ääìô¢üÒ¼Ýäüœü”+å$ƒd“”ÔZ�

Response Headers

Connection  Keep-Alive
Content-Encoding    gzip
Content-Length  127
Content-Type    text/css
Date    Wed, 18 Dec 2013 07:15:22 GMT
Expires Fri, 17 Jan 2014 14:15:22 +0700
Keep-Alive  timeout=5, max=100
Last-Modified   Wed, 18 Dec 2013 13:17:18 +0700
Server  Apache/2.2.25 (Win32) PHP/5.3.26
Vary    Accept-Encoding
X-Powered-By    PHP/5.3.26

请大家...谢谢

【问题讨论】:

    标签: php apache gzip mod-deflate


    【解决方案1】:

    看起来您正在压缩代码两次,一次使用 PHP,一次使用 mod_deflate。

    会是这样吗?

    【讨论】:

    • 我没有在 htaccess 中添加 mod_deflate 但我在 apache 上打开了模块
    • 我不太确定您是否还输出 gzip 压缩的内容。您的 content-type = gzip,这应该是 deflate。因此,现在您的内容已被压缩,但正在被 gzip 解析,这将无法正常工作,您会变得乱七八糟。禁用 mod_deflate 时的标题是什么?
    • 我一直是不活跃的 mod_deflate 并且仍然得到响应标头 Connection Content-Encoding gzip Content-Type text/javascript
    • 这意味着你的代码已经被压缩了,用 gzip 压缩它然后用 deflate 会得到不好的结果。你需要在你的 PHP 中找到你的内容被压缩的地方,.htaccess等。对于 PHP,请参阅:php.net/manual/en/function.ob-gzhandler.php
    • 感谢 flashin 帮助...这已经成功..我禁用 zlib.output_compression = On to Off..thanks broo
    猜你喜欢
    • 2015-07-14
    • 1970-01-01
    • 1970-01-01
    • 2011-10-11
    • 1970-01-01
    • 2011-05-04
    • 1970-01-01
    • 2017-12-24
    • 2012-01-18
    相关资源
    最近更新 更多