php pdf download getting corrupt
<p>I have a code which force download a pdf file. Code below</p>

<pre><code>$file_name = 'Bv_Ebook.pdf';
$file_url = 'http://' .$_SERVER['HTTP_HOST'].'/sites/default/files/'. $file_name;
header('Content-Type: text/html');
header("Content-Transfer-Encoding: Binary"); 
header("Content-disposition: attachment; filename=\"".$file_name."\""); 
readfile($file_url);
</code></pre>

<p>This code works on our beta server and the pdf is downloaded and can be opened. </p>

<p>On our live server same code downloads the pdf but pdf file cannot be opened, it says:</p>

<p><strong>Unable to open document</strong>
File type plain text document (text/plain) is not supported</p>

<p>I have gone though <a href="http://stackoverflow.com/questions/10682929/force-pdf-download-with-php-file-corrupt-on-windows">force download pdf</a> and <a href="http://stackoverflow.com/questions/3610746/serve-file-to-user-over-http-via-php">apache headers setting</a> but nothing seems to work.</p>

<p>Any idea what could be the issue?</p>
