title: Exporting data to .xls through php issue
body: <p>I am exporting data to a .xls file through php and having the following issue: when I export few rows, it's working ok, but when I export a large amount of rows, the spreadsheet is downloaded as a .php file.</p>
  
  <p>A summary of my code (named <strong>export.php</strong>):</p>
  
  <pre><code>header("Content-type: application/vnd.ms-excel;");
  
  echo 'Column1' . "\t" . 'Column2' . "\t" . 'Column3' . "\n";
  
  while($data = $sql_data-&gt;fetch(PDO::FETCH_ASSOC)){
     echo $data['column1'] . "\t" . $data['column2'] . "\t" . $data['column3'] . "\n";
  }
  
  header("Content-disposition: attachment; filename=file.xls");
  </code></pre>
  
  <p>When the exported spreadsheet is very large, it comes with the filename and extension of the php script (<strong>export.php</strong>) and yet I can open it with Microsoft Excel. So, I only wish it to come with the right filename and extension (<strong>file.xls</strong>) regardless of file size.</p>
  
  <p>Any idea?</p>