Bug #53627 [Opn->Csd]: ob_gzhandler don't gzip some JS file

From: Date: Wed, 29 Dec 2010 16:02:10 +0000
Subject: Bug #53627 [Opn->Csd]: ob_gzhandler don't gzip some JS file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-157383@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53627&edit=1 ID: 53627 User updated by: dmaillefer at gmail dot com Reported by: dmaillefer at gmail dot com Summary: ob_gzhandler don't gzip some JS file -Status: Open +Status: Closed Type: Bug Package: Output Control Operating System: windows PHP Version: 5.3.4 Block user comment: N Private report: N New Comment: hello I gzip the JS file directy in my folder and then I do $s = file_get_contents('mootools.js.gz'); header("Content-Encoding: gzip"); echo $s; chrome show me the javascript if I delete header("Content-Encoding: gzip"); I get unreadable caractere. But in chrome no information concerning the compression !!!!!!! Previous Comments: ------------------------------------------------------------------------ [2010-12-29 11:59:29] dmaillefer at gmail dot com Description: ------------ hello when I try to create compression function on CSS and JS file I found a strange issue all my css file and JS file is correctly Gziped but not JQuery.js (minimized or not) I try with a regulard PHP code (ob_start('ob_gzhandler') ) or directly in the php.ini (zlib.output_compression = On) the result is the same the Jquery JS will not be compressed If I delete some line in the file compression is done (but the file is incomplet) If I add other file (to the JQuery JS) who are correctly compressed the all file are not compressed If I configure in Apache the mod_deflate all file are Gziped The JQuery file are here http://jquery.com/ I look if the compression is done with chrome (developement tools) Here when the compression is done with PHP http://img709.imageshack.us/f/screenshot220t.jpg/ Here where the compression is done with Apache http://img52.imageshack.us/f/screenshot221q.jpg/ In the HTTP header response the GZIP is correctly set the file I use is here http://www.megaupload.com/?d=AVY3LFQO best regards Test script: --------------- <?php // to activate to compress with PHP /* if(extension_loaded('zlib')){ ob_start('ob_gzhandler'); }*/ header("Content-type: application/javascript"); header ('cache-control: must-revalidate'); $offset = 60 * 60 * 24; $expire = 'expires: ' . gmdate ('D, d M Y H:i:s', time() + $offset) . ' GMT'; header ($expire); // test with include // liste JS files to be included //include 'jquery-1.4.4.min.js'; //include 'sha256.min.js'; // test with join file echo join('',file('sha256.min.js')); // works echo join('',file('test.js')); // works echo join('',file('style.css')); // works echo join('',file('jquery-1.4.4.min.js')); // never works // test with file get content //$file = file_get_contents('jquery-1.4.4.min.js'); //echo $file; // to activate to compress with PHP /*if(extension_loaded('zlib')){ob_end_flush();}*/ ?> Expected result: ---------------- I just want to andersted what's happen, and why the compression fail with this JS file ? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53627&edit=1

« previous php.bugs (#157383) next »