title: PHPExcel generated file via $objWriter->save('php://output')- does it require permissions?
body: <p>I have a code in php CodeIgniter that extracts data from database and generates an xls file via PHPExcel.<br/><br/>
  The problem is that whenever I upload the code into another server, it generates an .xls file with 0kb, and the error while opening is:<br/>
  "Excel cannot open the file "____" because the file format or file extension not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file".<br/><br/>
  The incoming data is from same table and all the libraries used are also same.</p>
  
  <p><strong>My questions:</strong><br/>
  1. Are there any r/w permission applied by the server which makes the phpexcel file 0kb? I am using CodeIgniter.<br>
  2. Is there any way to see what is written in the PHPExcel object?<br>
  3. Are there any things I am missing out?</p>
  
  <p>My code that generates xls file is:
  <br></p>
  
  <pre><code>// Set header and footer. When no different headers for odd/even are used, odd header is assumed.
      $objPHPExcel-&gt;getActiveSheet()-&gt;getHeaderFooter()-&gt;setOddHeader('&amp;L&amp;BInvoice&amp;RPrinted on &amp;D');
      $objPHPExcel-&gt;getActiveSheet()-&gt;getHeaderFooter()-&gt;setOddFooter('&amp;L&amp;B' . $objPHPExcel-&gt;getProperties()-&gt;getTitle() . '&amp;RPage &amp;P of &amp;N');
  
  // Set page orientation and size
      $objPHPExcel-&gt;getActiveSheet()-&gt;getPageSetup()-&gt;setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
      $objPHPExcel-&gt;getActiveSheet()-&gt;getPageSetup()-&gt;setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
  
  // Set active sheet index to the first sheet, so Excel opens this as the first sheet
      $objPHPExcel-&gt;setActiveSheetIndex(0);
  
      $this-&gt;load-&gt;library('PHPExcel/PHPExcel_IOFactory');
  
      $file_name = $uri_year . "-" . $uri_month . "_staff_report.xlsx";
  // Redirect output to a client web browser (Excel2007)
  //ob_end_clean();
      header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
      header('Content-Disposition: attachment;filename=' . $file_name);
      header('Cache-Control: max-age=0');
  
      $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
  //  ob_end_clean();
  
      $objWriter-&gt;save('php://output');
  </code></pre>
  
  <p>Thank you in advance.</p>
  
  <p><br>
  My output as displayed in the test server is:<br><br>
  <img src="https://i.stack.imgur.com/OHHzI.png" alt="enter image description here"><br><br></p>
  
  <p><b>Solution:</b>
  It turns out that the php version of the server1 is 5.2.9 <br/>
  The php version of server2 is 5.1.6<br/></p>
  
  <p>Error generated in server2:
  Fatal error: Class 'ZipArchive' not found in /var/www/html/APP_NAME/application/libraries/PHPExcel/Writer/Excel2007.php on line 225</p>
  
  <p><br/>
  The ZipArchive module requires php version >5.2 <br/></p>
  
  <p>After the update, it works.</p>
  
  <p>Thank you guys for your suggestions.</p>