title: PHPExcel_Writer_Exception with message "Could not close zip file php://output."
body: <p>I'm using PHPExcel to export some data to user in an excel file. I would like the script to send the excel file to the user immediately after it's creation. Here is my test code:</p>
  
  <pre><code>try{
  
    /* Some test data */
    $data = array(
      array(1, 10   , 2             ,),
      array(3, 'qqq', 'some string' ,),
    );
  
    $objPHPExcel = new PHPExcel();
    $objPHPExcel-&gt;setActiveSheetIndex(0);
  
    /* Fill the excel sheet with the data */
    $rowI = 0;
    foreach($data as $row){
      $colI = 0;
      foreach($row as $v){
        $colChar = PHPExcel_Cell::stringFromColumnIndex($colI++);
        $cellId = $colChar.($rowI+1);
        $objPHPExcel-&gt;getActiveSheet()-&gt;SetCellValue($cellId, $v);
      }
      $rowI++;
    }
  
    header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    header('Content-Disposition: attachment;filename="export.xlsx"');
    header('Cache-Control: max-age=0');
  
    $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
    $objWriter-&gt;save('php://output');
  
  }catch(Exception $e){
    echo $e-&gt;__toString();
  }
  </code></pre>
  
  <p>On my local server <code>(Windows 7 x64, Php 5.3.8, Apache 2.2.21)</code> I get a valid xlsx file. There are no errors. 
  But there is problem on the live server <code>(Linux 2.6.32-5-amd64, PHP 5.3.3-7+squeeze13, Apache 2.2.16)</code>. The script lets the browser to download the "export.xlsx" file with such content:</p>
  
  <pre><code>exception 'PHPExcel_Writer_Exception' with message 'Could not close zip file php://output.' in /var/www/someuser/data/www/somedomain.com/libs/PHPExcel/Writer/Excel2007.php:348
  Stack trace:
  #0 /var/www/someuser/data/www/somedomain.com/classes/Report/Leads/Export.php(339): PHPExcel_Writer_Excel2007-&gt;save('php://output')
  #1 /var/www/someuser/data/www/somedomain.com/application/pages/account/controllers/TestController.php(13): Report_Leads_Export-&gt;Test()
  #2 /var/www/someuser/data/www/somedomain.com/libs/Zend/Controller/Action.php(516): Account_TestController-&gt;indexAction()
  #3 /var/www/someuser/data/www/somedomain.com/libs/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action-&gt;dispatch('indexAction')
  #4 /var/www/someuser/data/www/somedomain.com/libs/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard-&gt;dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
  #5 /var/www/someuser/data/www/somedomain.com/index.php(511): Zend_Controller_Front-&gt;dispatch()
  #6 {main}
  </code></pre>
  
  <p>PHP is NOT running in Safe Mode. The "open_basedir" option is empty (it's commented out).</p>
  
  <p>I have found such code in the PHPExcel files:</p>
  
  <pre><code>if ($objZip-&gt;close() === false) {
      throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename.");
  }
  </code></pre>
  
  <p>So the reason of the problem is that <code>$objZip-&gt;close() === false</code> where <code>$objZip</code> is an instance of <code>ZipArchive</code> class.</p>
  
  <p>What is the reason of the problem and how can I solve it? Thank you.</p>