note 60638 added to function.header

From: Date: Thu, 12 Jan 2006 20:53:17 +0000
Subject: note 60638 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-101656@lists.php.net to get a copy of this message
I was having trouble with streaming inline PDf's using PHP 5.0.2, Apache 2.0.54. This is my code: <? header("Pragma: public"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: must-revalidate"); header("Content-type: application/pdf"); header("Content-Length: ".filesize($file)); header("Content-disposition: inline; filename=$file"); header("Accept-Ranges: ".filesize($file)); readfile($file); exit(); ?> It would work fine in Mozilla Firefox (1.0.7) but with IE (6.0.2800.1106) it would not bring up the Adobe Reader plugin and instead ask me to save it or open it as a PHP file. Oddly enough, I turned off ZLib.compression and it started working. I guess the compression is confusing IE. I tried leaving out the content-length header thinking maybe it was unmatched filesize (uncompressed number vs actual received compressed size), but then without it it screws up Firefox too. What I ended up doing was disabling Zlib compression for the PDF output pages using ini_set: <? ini_set('zlib.output_compression','Off'); ?> Maybe this will help someone. Will post over in the PDF section as well. ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60638 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60638&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60638&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60638&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60638&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60638&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60638&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60638&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60638&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101656) next »