|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17603 ini_set can't disable zlib
Submitted: 2002-06-04 20:33 UTC Modified: 2004-05-31 19:14 UTC
From: anon-php at sitefoundry dot com Assigned:
Status: Closed Package: Zlib related
PHP Version: 4.3.2 OS: all
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: anon-php at sitefoundry dot com
New email:
PHP Version: OS:


 [2002-06-04 20:33 UTC] anon-php at sitefoundry dot com
I have the following line in my php.ini:
  zlib.output_compression = On

In experimenting with this, I attempted to disable it within a script (mostly because I wanted to defeat the output buffering that zlib performs). I tried several variations of this line in a script:
    ini_set('zlib.output_compression', '0');
    ini_set('zlib.output_compression', 0);
    ini_set('zlib.output_compression', 'off');

In all cases, output is still compressed. Here is a complete script:
    ini_set('zlib.output_compression', '0');
    echo "If compression is disabled, you should be able to read this via 'lynx -mime_header'";

You can see it here:

I get this output:
HTTP/1.1 200 OK
Date: Wed, 05 Jun 2002 00:30:51 GMT
Server: Apache/1.3.22
Content-Encoding: gzip
Connection: close
Content-Type: text/html

[non-ascii junk here]

Here is my configure line:
./configure --with-apache=/usr/local/src/apache_1.3.22 --with-gd=/usr/local --with-imap --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/apache/conf --enable-debug=no --enable-track-vars=yes --with-zlib --enable-calendar


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-05 06:21 UTC]
This is quite logical because the output compression starts before your script is executed. If you disable it in your script after it has been started it won't be stopped.

You can _try_ a couple of ob_end_clean()'s (use ob_get_level() to find out how many) to stop it. 

Reopening as a documentation problem.
 [2002-06-05 10:07 UTC] anon-php at sitefoundry dot com
Thanks for the suggestion. I regret to report that I can't make it work: no number of calls to flush(), ob_end_clean(), or ob_implicit_flush() allow the script to output non-compressed data.

So, this comment: "If you disable it in your script after it has been
started it won't be stopped." actually seems to mean "It is not possible to disable zlib output compression or buffering within a script." IMO this would be useful to note on the manual page for ini_set().
 [2002-06-18 06:17 UTC]
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at In case this was a documentation 
problem, the fix will show up soon at
In case this was a website problem, the change will show
up on the site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

changed value from "PHP_INI_ALL" to "PHP_INI_SYSTEM|PHP_INI_PERDIR" for "zlib.output_compression"
 [2003-03-22 14:21 UTC] phpuser at dpiworld dot com
The current online documentation still (incorrectly) lists:  
  zlib.output_compression as "PHP_INI_ALL" 

on page:
 [2003-03-22 14:59 UTC]
The ini table is now autogenerated off PHP source so any changed text in the docs has been written over.  Snipped from the source (/ext/zlib/zlib.c):

STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL..
STD_PHP_INI_ENTRY("zlib.output_compression_level","-1", PHP_INI_ALL..
STD_PHP_INI_ENTRY("zlib.output_handler", "", PHP_INI_ALL..

Either the source needs to be changed OR someone explains how this should be documented.  Reopening as a zlib related problem.
 [2003-03-22 18:48 UTC]
Docs and sources are fine now.

 [2004-05-31 19:14 UTC]
I also removed a comment about being about to ini_set the directive from ref.zlib.php
 [2020-02-07 06:12 UTC]
Automatic comment on behalf of georg
Log: fixed bug #17603 - removed zlib features from docu
 [2020-02-07 06:12 UTC]
Automatic comment on behalf of cortesi
Log: fix bug #17603
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 09:01:32 2024 UTC