note 81667 added to function.ob-start

From: Date: Sun, 09 Mar 2008 10:19:23 +0000
Subject: note 81667 added to function.ob-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-136856@lists.php.net to get a copy of this message
Some web hosting servers (mine do, at least) have in their php.ini the following setting: output_handler = ob_gzhandler This proved problematic for php-scripts which returns an image or a binary file in general, since there is no way to determine the content length of the compressed file. Since I spent a lot of time scouring the net searching for a work-around (.htaccess-modifications were out of the picture for various reasons), I found this to work nicely to cancel out the ob_gzhandler specified in the php.ini: <?php while (ob_get_level()) ob_end_clean(); header("Content-Encoding: None", true); ?> Put this at the top of the script before anything else is written to the page, and the script result will not be compressed. ---- Server IP: 62.73.196.231 Probable Submitter: 88.88.68.253 ---- Manual Page -- http://www.php.net/manual/en/function.ob-start.php Edit -- https://master.php.net/note/edit/81667 Del: integrated -- https://master.php.net/note/delete/81667/integrated Del: useless -- https://master.php.net/note/delete/81667/useless Del: bad code -- https://master.php.net/note/delete/81667/bad+code Del: spam -- https://master.php.net/note/delete/81667/spam Del: non-english -- https://master.php.net/note/delete/81667/non-english Del: in docs -- https://master.php.net/note/delete/81667/in+docs Del: other reasons-- https://master.php.net/note/delete/81667 Reject -- https://master.php.net/note/reject/81667 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136856) next »