你能在关闭 zlib 压缩的情况下进行 gzip 吗
我真的很想加快网站优化速度,因为我的大多数网站确实速度不够。我正在使用 http://gtmetrix.com/ 来测试我的网站速度。
我真正需要做的一件事是使用 gzip 压缩。我花了很长时间试图让它发挥作用,但无法弄清楚我哪里出了问题。
如果我单击 Web 开发人员工具栏中的更多信息,它会显示 gzip 已启用,因此这是欺骗性的,因为事实并非如此。我联系了我的托管提供商并得到了以下答复:
不幸的是,Gzip 会给我们的托管造成太多负载 服务器因此任何类似的程序都会导致相同的压力。
因此,即使它说它已启用,我认为您需要在 php.ini 文件中检查的内容是正确的:
zlib.output_compression Off Off
zlib.output_compression_level -1 -1
zlib.output_handler no value no value
好的,所以我认为需要将其设置为打开以允许 gzip 压缩。这是正确的吗?
基本上我必须去一个专用服务器才能允许 gzip 每月 70 英镑。
所以我想我要问的是:有没有一种方法可以使用 PHP 来利用 gzip 压缩,而无需托管提供商启用它?我尝试了很多选择,但到目前为止没有成功。
谢谢
I am really trying to get up to speed with website optimization as most off my websites really lack in speed. I am using http://gtmetrix.com/ to test my website speed.
One thing I really need to do is use gzip compression. I spent ages trying to get it to work and could not figure out where i was going wrong.
If I click more information in web developer toolbar it said gzip enabled so this was decieving as it isn’t. I contacted my hosting providers and got the following response:
Unfortunately not, Gzip would cause too much load on our hosted
servers therefore any similar programs would cause the same strain.
So even when it says it is enabled, I think I am right in saying what you need to check for in the php.ini file is:
zlib.output_compression Off Off
zlib.output_compression_level -1 -1
zlib.output_handler no value no value
Ok, so I assume this needs to be set to on to allow gzip compression. Is this correct?
Basically I would have to go for a dedicated server to allow for gzip £70 a month.
So I guess what I am asking is: Is there a way using PHP to utillise gzip compression without it being enabled by the hosting provider? I have tried many option but none successful so far.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
gzip/deflate 不会增加显着的负载。然而,这些诈骗价格并不值得。
至于 PHP,它也可以从脚本中启用:
如果不可用,可以通过 gzencode() 进行模拟;但我认为开销太大了..
gzip/deflate adds no significant load. Those rip-off prices aren't worth it however.
As for PHP, it can also be enabled from within scripts:
Would be emulatable via gzencode() if not available; but too much overhead I'd assume..