|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53627 ob_gzhandler don't gzip some JS file
Submitted: 2010-12-29 11:59 UTC Modified: 2010-12-29 17:02 UTC
From: dmaillefer at gmail dot com Assigned:
Status: Closed Package: Output Control
PHP Version: 5.3.4 OS: windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: dmaillefer at gmail dot com
New email:
PHP Version: OS:


 [2010-12-29 11:59 UTC] dmaillefer at gmail dot com

when I try to create compression function on CSS and JS file I found a strange 

all my css file and JS file is correctly Gziped but not JQuery.js (minimized or 

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 
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
I look if the compression is done with chrome (developement tools)
Here when the compression is done with PHP
Here where the compression is done with Apache
In the HTTP header response the GZIP is correctly set

the file I use is here

best regards

Test script:

// to activate to compress with PHP
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

Expected result:
I just want to andersted what's happen, and why the compression fail with this JS 
file ?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-29 17:02 UTC] dmaillefer at gmail dot com
-Status: Open +Status: Closed
 [2010-12-29 17:02 UTC] dmaillefer at gmail dot com

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 !!!!!!!
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Mar 22 10:03:43 2023 UTC