1. #1
    Ext User manugoel2003's Avatar
    Join Date
    Mar 2007
    Location
    New Delhi, India
    Posts
    314
    Vote Rating
    0
    manugoel2003 is on a distinguished road

      0  

    Default How to implement GZIP using PHP

    How to implement GZIP using PHP


    Hi,

    I am trying to implement Gzipping. I am using PHP as a backend and cross-browser support is a must. But I have a few queries.

    1. Is it a good idea to Gzip all the JS & CSS or should only JS be Gzipped. And what all files can be Gzipped.
    2. Is it possible to use Gzipping on HTML as well
    3. I hope all this can be done in PHP only, coz I dont know any other server-side technology.
    4. And is all this done on-the-fly transparently at the client end, or do I have to do geeky coding for it.
    5. And lastly, How do I actually go about doing it?


    Thanx
    Manu

  2. #2
    Ext User manugoel2003's Avatar
    Join Date
    Mar 2007
    Location
    New Delhi, India
    Posts
    314
    Vote Rating
    0
    manugoel2003 is on a distinguished road

      0  

    Default


    And ya, I forgot to mention that I have already followed some advice from the following article, but it didnt help.

    http://www.fiftyfoureleven.com/sandb...ss-gzip-method

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,499
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    This has been discussed. I posted a solution for J2EE developers.

    http://www.yui-ext.com/forum/viewtopic.php?t=1304#5550

  4. #4
    Ext User manugoel2003's Avatar
    Join Date
    Mar 2007
    Location
    New Delhi, India
    Posts
    314
    Vote Rating
    0
    manugoel2003 is on a distinguished road

      0  

    Default


    Ya I already read that post, but as it is for J2EE developers I cannot understand it very well, much less implement it. A PHP based solution would be a great help.

  5. #5
    Ext User
    Join Date
    Mar 2007
    Posts
    122
    Vote Rating
    0
    moraes is on a distinguished road

      0  

    Default


    Some links of interest:

    http://www.dustindiaz.com/yahoo-event-utility/
    http://www.ilovejackdaniels.com/php/...-and-htaccess/

    I'm interested in a solution specific for YUI-ext, but I'll be back to this subject after I advance a little more on my app.

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,499
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

  7. #7
    Ext User manugoel2003's Avatar
    Join Date
    Mar 2007
    Location
    New Delhi, India
    Posts
    314
    Vote Rating
    0
    manugoel2003 is on a distinguished road

      0  

    Default


    Thanx a lot for the replies.... I'll go through them and see if anything works out... btw, which method is better - Zlib or the Output Buffer if I am using Zend Framework and using its rewrite engine??....

  8. #8
    Ext User
    Join Date
    Mar 2007
    Posts
    80
    Vote Rating
    0
    Slapyo is on a distinguished road

      0  

    Default


    http://www.yui-ext.com/forum/viewtopic.php?t=1669

    I just posted about gzipping css and js files, didn't see this thread ... and sadly I forgot to search prior to making my post. But searched google and found the link that manugoel2003 provided in the second post. It helped me out a bunch.

  9. #9
    Ext User manugoel2003's Avatar
    Join Date
    Mar 2007
    Location
    New Delhi, India
    Posts
    314
    Vote Rating
    0
    manugoel2003 is on a distinguished road

      0  

    Default


    hey guys this script is working for CSS files
    Code:
    <?php
    	ob_start ("ob_gzhandler");
    	header("Content-type: text/css; charset: UTF-8");
    	header("Cache-Control: must-revalidate");
    	$offset = 60 * 60 ;
    	$ExpStr = "Expires: " .
    	gmdate("D, d M Y H:i:s",
    	time() + $offset) . " GMT";
    	header($ExpStr);
    ?>
    and there is a corresponding version for JS as well
    Code:
    <?php
    	ob_start ("ob_gzhandler");
    	header("Content-type: application/x-javascript; charset: UTF-8");
    	header("Cache-Control: must-revalidate");
    	$offset = 60 * 60 ;
    	$ExpStr = "Expires: " .
    	gmdate("D, d M Y H:i:s",
    	time() + $offset) . " GMT";
    	header($ExpStr);
    ?>
    Thank u all for ur help.... but I was not able to make the auto-prepend work in htaccess file.... I am using this code in my htaccesss file
    Code:
    AddHandler application/x-httpd-php .css
    php_value auto_prepend_file gzip-css.php
    Any idea what may be wrong in this??

    And what tools can I use for monitoring file-size and other such details in IE and Firefox.... I am currently using Firebug which does not give any details on the filesize and gzipping... I would like to monitor both the AJAX response sizes and the file sizes


    Thanx all


    Manu
    manu@value-one.com
    www.e11online.com

  10. #10
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,499
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Get the latest Firebug from http://getfirebug.com/

    You can monitor the size and time of every HTTP request.

Similar Threads

  1. gzip JS and CSS files?
    By Slapyo in forum Ext 1.x: Help & Discussion
    Replies: 17
    Last Post: 24 Nov 2009, 7:05 PM
  2. How to implement a CustomRenderer
    By mauro_monti in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 28 Feb 2007, 11:10 AM
  3. gzip
    By Charles in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 25 Feb 2007, 4:40 PM
  4. Trying to implement Basic Resizable around iFrame
    By bernieott in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 21 Dec 2006, 6:06 AM
  5. Providing compressed (gzip) .js file
    By liotrox in forum Community Discussion
    Replies: 14
    Last Post: 14 Dec 2006, 9:07 AM

Thread Participants: 4

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi