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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
susapra
Forum Newbie
Posts: 2
Joined: Sun Sep 21, 2008 11:22 am

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

Post 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
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

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

Post 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
Post Reply