note 60638 deleted from function.header by tularis

From: Date: Fri, 20 Apr 2007 14:41:24 +0000
Subject: note 60638 deleted from function.header by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-125653@lists.php.net to get a copy of this message
Note Submitter: spingary at yahoo dot com ---- 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.

« previous php.notes (#125653) next »