title: PDF file download using PHP is getting corrupted in server
body: <p>I've implemented a download script using PHP headers to download PDF files. My script is working fine and downloading the corresponding PDF file also in my localhost but that script is not working in my server.</p>
  
  <p>My code is:</p>
  
  <pre><code>header("Content-Disposition: attachment; filename='dfile.pdf'");
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Content-type: application/pdf;");
  
  readfile("http://www.education.gov.yk.ca/pdf/pdf-test.pdf");
  </code></pre>
  
  <p>In my server file browser is appearing fine and downloading the file also as <code>dfile.pdf</code>, but If I try to open the downloaded file then I'm getting an error message of <code>the file has been damaged</code>. Any of my server settings causing this issue or something else?</p>
  
  <p>Any suggestion to fix this problem is much appreciable.</p>
  
  <p>Note: I think this might be an issue with my server PHP settings, can anybody tell me whether the "readfile" function need any PHP setting to enable in my server?</p>
  
  <p>Thanks in advance,
  Siva...</p>