Fra*_*kie 8 php apache mod-deflate
我遇到一些麻烦阻止mod_deflate跳进这个场景:
问题是Apache总是将内容检测为正在存在php,因此服务器假定ZIP文件是PHP文件,因此下面的行将不会起作用.
<FilesMatch "\.(xml|txt|html|php)$">
SetOutputFilter DEFLATE
</FilesMatch>
Run Code Online (Sandbox Code Playgroud)
关于我如何让Apache区别于同一index.php框架文件生成的HTML文件或ZIP文件的任何想法.
编辑:
apache日志
[Mon Jun 20 02:14:19 2011] [debug]
mod_deflate.c(602): [client 192.168.0.5]
Zlib: Compressed 50870209 to 50878224 : URL /index.php,
referer: http://demo.dev/
Run Code Online (Sandbox Code Playgroud)
编辑:
提供zip的CI控制器
header('Content-Type: application/zip');
header('Content-Transfer-Encoding: binary');
header("Content-Length: " . filesize($file_location));
header('Content-Disposition: attachment; filename="' . $file_title . '"');
readfile($file_location);
Run Code Online (Sandbox Code Playgroud)
即使是艰难的所有答案都应该在合理的情况下完全有效(并且在提出问题之前进行了实际测试),之所以我无法指示Apache通过MIME-Type缩小文件的原因仍然未知.
我可以通过强制将以下指令放入脚本中来使其按预期工作
apache_setenv('no-gzip', 1);
ini_set('zlib.output_compression', 0);
Run Code Online (Sandbox Code Playgroud)
我确实理解这是一个热门补丁,并没有解决问题的根源,但到目前为止还不够.由于还有其他人可能会遇到相同的标志,上面的代码留在这里作为脏修复的参考.
| 归档时间: |
|
| 查看次数: |
4411 次 |
| 最近记录: |