Friday, November 6, 2015

GZIP with PHP



Hello there!

Today we are going to talk about GZIP compression with PHP.

GZIP is a compression method used by web servers to compress the content of a web page and send it to the client(web browser). Using this more bandwidth will be saved and the web pages are loaded faster.
But the problem is most of the web developers are not aware about it.
Google, Yahoo and Facebook are some examples for websites that use GZIP to compress web page contents.

First of all you should know that GZIP is an compression method, not an encryption method.
Most of the web servers and browsers support GZIP.
GZIP is actually a file format which is used for file compression and decompression. When a web server receive an page request from a client web server will send the page details as in the actual size of the page. (sometimes this page will be 100 KB large)
When a web server which uses GZIP receive an page request web server will use GZIP and compress the web page so that the web page size will be reduced. This will help user to load the web pages faster and save the bandwidth.

Adding GZIP to your web page is very simple and easy., you all have to do is add some simple line of code to your web pages.

Copy and paste the following code snippet to the very beginning of your web page.


<?php ob_start("ob_gzhandler"); ?>

Now your web page will be served to the user faster.


Comment for any questions, suggestions, compliments or complaints.

Past Topics :-