启用PHP服务器上的GZIP? [英] Enable GZIP on a PHP server?

查看:89
本文介绍了启用PHP服务器上的GZIP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要狂饮作乐,以提高速度我的网站和优化我所能在合理范围内,有一件事我想进入被编辑一些的Apache / MySQL的配置,这样我就可以减少网页加载时间,我想尝试的东西与的.htaccess 但我讨厌500错误随之而来,因为我得到了PHP,我希望这样做GZIP COM pression那里。

I was going on a binge to increase speed of my website and optimize what I can within reason, one thing I wanted to go into was editing some Apache/MySQL configurations so I can decrease page loading time, I wanted to try something with .htaccess but I hate 500 errors that ensues, as I got PHP I'm wishing to do GZIP compression there.

我想补充,以及我应该如何实现它在我自己的code一些指点?

What would I add, and some pointers on how I should implement it in my own code?

和也,GZIP是COM pression库的一部分?

And also, GZIP is a part of what compression library?

推荐答案

通常,你只需要 ob_start(ob_gzhandler)添加到你的第一个页面,确保你没有输出内容事先并很会照顾所有其余的为您服务。您可能需要确保浏览器不是Netscape的(3),因为它不能处理GZ编码。

Conventionally you would only need to add ob_start("ob_gzhandler") to the first of your page, be sure you output no content beforehand and it will take care of all of the rest for you. You may want to ensure the browser isn't Netscape (3) as it can't handle GZ encodings.

而且,GZIP是COM pression库的一部分?

GZIP是zlib库的一部分,因此需要其作为依赖关系

GZIP is part of the ZLib library, and thus requires it as a dependancy.

这篇关于启用PHP服务器上的GZIP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆