Gzipping

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Gzipping

Postby ahmed.abdelsamad » 23. June 2011 22:34

Hi All
i am working on a XAMPP
1.7.4
[PHP: 5.3.5]
on localhost
i am trying to Gzip my files.
i am writting this piece of code at the top of my .php file
Code: Select all
<?php
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
   ob_start("ob_gzhandler");
    }
?>


But when i check the http headers using firebug the header doesn't show that the data was gzipped and the file size was exactly the same. Do i need to start any certain modules or change anything in the php.ini file ..?!
Thank you in advance
ahmed.abdelsamad
 
Posts: 1
Joined: 23. June 2011 22:09

Re: Gzipping

Postby Nobbie » 24. June 2011 10:08

1) You dont need you check whether "gzip" is supported by the browser, because ob_gzhandler() automatically checks, if the browser supports gzip. Remove that if-clause.

2) ob_gzhandler requires the zlib extension

3) ... you easily could find that on yourself by reading the original php doc http://www.php.net/manual/en/function.ob-gzhandler.php
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: gunfacts and 146 guests