From:
Operating system: CentOS 5.5 32bit
PHP version: 5.2.17
Package: Zlib related
Bug Type: Bug
Bug description:ini_set zlib.output_compression On returns false
Description:
------------
PHP is compiled with the following options:
System => Linux serv01.testmachine.com 2.6.28.5-grsec-sg2 #6 SMP Fri Feb 20
02:45:11 CST 2009 i686
Build Date => Mar 21 2011 10:04:49
Configure Command => './configure' '--prefix=/usr/local/php52'
'--mandir=/usr/man' '--with-config-file-path=/usr/local/php52/lib'
'--with-config-file-scan-dir=/usr/local/php52/etc'
'--with-pear=/usr/local/php52/pear' '--with-litespeed'
'--enable-discard-path' '--enable-sigchild' '--disable-fastcgi'
'--enable-magic-quotes' '--with-db4' '--disable-force-cgi-redirect'
'--disable-ipv6' '--with-openssl' '--with-zlib' '--with-zlib-dir'
'--enable-bcmath' '--with-bz2' '--enable-calendar' '--with-curl'
'--with-curlwrappers' '--enable-exif' '--enable-ftp' '--with-kerberos'
'--with-gd' '--with-pspell' '--with-libedit' '--with-jpeg-dir'
'--with-png-dir' '--with-xpm-dir' '--with-freetype-dir' '--with-t1lib'
'--enable-gd-native-ttf' '--with-ttf' '--with-gettext' '--with-imap'
'--with-imap-ssl' '--with-ldap' '--with-ldap-sasl' '--enable-mbstring'
'--with-mcrypt' '--with-mhash' '--with-mysql'
'--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli'
'--with-ncurses' '--enable-pcntl' '--with-pdo-mysql' '--with-pdo-pgsql'
'--with-pgsql' '--with-readline' '--enable-shmop' '--with-snmp=shared'
'--enable-ucd-snmp-hack' '--enable-soap' '--enable-sockets'
'--enable-sqlite-utf8' '--enable-wddx' '--with-tidy' '--with-xmlrpc'
'--enable-zip' '--with-xsl=/usr' '--with-libxml-dir=/usr'
'--enable-zend-multibyte'
In the master php.ini file zlib.output_compression is set to off as
reported by phpinfo();
zlib.output_compression => Off => Off
Many applications are using the code shown in the test script to initiate
the compression of their headers.
With PHP 5.2.17 from the stable repo (snaps too!) return false on the
following line:
$r = @ini_set('zlib.output_compression', 'On');
Even it is returning false zlib.output_compression is actually enabled and
when it reaches ob_start('ob_gzhandler'); because of the false results the
following error is produced:
[21-Mar-2011 03:18:43] PHP Warning: ob_start() [<a
href='ref.outcontrol'>ref.outcontrol</a>]: output handler 'ob_gzhandler'
conflicts with 'zlib output compression' in
/home/jeepchic/public_html/header.php on line 767
Test case script I provided here works just fine on PHP 5.2.9.
Test script:
---------------
<?
if (function_exists('gzopen')) {
$r = @ini_set('zlib.output_compression', 'On');
$r2 = @ini_set('zlib.output_compression_level', '3');
if (!$r || !$r2) {
echo "Fail\n";
ob_start('ob_gzhandler');
} else {
echo "success\n";
}
} else {
echo "Fallback\n";
ob_start('ob_gzhandler');
}
?>
Expected result:
----------------
echo "success\n";
Actual result:
--------------
echo "Fail\n";
--
Edit bug report at http://bugs.php.net/bug.php?id=54333&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54333&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54333&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54333&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54333&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54333&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54333&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54333&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54333&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54333&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54333&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54333&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54333&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54333&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54333&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54333&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54333&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54333&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54333&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54333&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54333&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54333&r=mysqlcfg