Dharmesh
Dharmesh

Reputation: 1059

gzencode not compressing the code

possible duplicates - Why is php gzip output not working for me?

I want to test whether my site is actually getting compressed or not.

I have used gzencode($data,9) - maximum compression. I also checked my website via http://www.gidnetwork.com/tools/gzip-test.php to check whether gzip is working or not and it was getting gziped.

But when I inspect the request via firebug OR in chrome I dont see any difference in the size of the request before compression and after compression.I mean both are same.

Even that gzib test tool above show same data in both cases : gzencode($data,0) and gzencode($data,9)

Now, I am not getting why its showing the page size same in both the cases.

Please help.

Thanks

Upvotes: 0

Views: 1282

Answers (1)

Mrinmoy Ghoshal
Mrinmoy Ghoshal

Reputation: 2834

You can use another alternative method to do this work.

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

  <html>
   <body>
      <p>This should be a compressed page.</p>
   </body>
 </html>

 <?php
  ob_end_flush();
  ?>

Note:

ob_gzhandler() requires the zlib extension. ob_gzhandler

Upvotes: 1

Related Questions