John
John

Reputation: 3318

Enable GZIP on a PHP server?

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.

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

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

Upvotes: 2

Views: 720

Answers (2)

Daniel
Daniel

Reputation: 2501

You can get more information on php.net site ( php.net/ob_start for examplle )

Upvotes: 0

Nullw0rm
Nullw0rm

Reputation: 913

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.

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

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

Upvotes: 3

Related Questions