Page 1 of 1

Header() script works here, not there...

Posted: Sun Sep 21, 2008 11:25 am
by susapra
The following script works properly in my test environment (Apache 2.2.8, php 5.2.5), but not on my live host's environment (Apache 2.2.6, php 5.2.5):

<?php
$filename = $_SERVER['DOCUMENT_ROOT'] . "/waiver.pdf";
header("Cache-Control: Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Description: File Transfer");
header('Content-disposition: attachment; filename='.basename($filename));
header("Content-Type: application/pdf");
header("Content-Transfer-Encoding: binary");
header('Content-Length: '. filesize($filename));
readfile($filename);
?>

In the test environment I get an opportunity to save or open the file. At the live environment, the browser remains at the link that triggers the above code. Behavior is the same in both IE7 & Firefox2.

I imagine there's a server setting somewhere that makes the difference. Any clues on where best to look?

______________________________
wedding gift Audi A4 Control Arm Bushings

Re: Header() script works here, not there...

Posted: Sun Sep 21, 2008 2:29 pm
by yacahuma
Download the document to your desktop and check it out with a text editor. This recently happened to me. There was something different in the env and the error was there is the pdf