title: PHPExcel export not working : displays "the website cannot be reached"
body: <p>I have cloned a project from server and installed in my local setup.
  I am trying to export excel file to the browser using PHPExcel. It is working fine in the server. But there is problem with the local setup. 
  Also I checked number of columns and fields and they are fine.
  Below is the code: </p>
  
  <pre><code>&lt;?php
  //PHPExcel starts from here
  error_reporting(E_ALL);
  ini_set('display_errors', TRUE);
  ini_set('display_startup_errors', TRUE);
  date_default_timezone_set('Asia/Kathmandu');
  
  if (PHP_SAPI == 'cli')
      die('Error in loading PHPExcel');
  
  
  // Create new PHPExcel object
  $objPHPExcel = new PHPExcel();
  
  // Set document properties
  $objPHPExcel-&gt;getProperties()-&gt;setCreator("GBD Admin")
          -&gt;setLastModifiedBy("GBD Admin")
          -&gt;setTitle("Weekly checkin/checkout log")
          -&gt;setDescription("Test document for PHPExcel, generated using PHP classes.")
          -&gt;setKeywords("Checkin/Checkout Logs")
          -&gt;setCategory("Checkin/Checkout Logs");
  
  
  // Add some data
  $objPHPExcel-&gt;setActiveSheetIndex(0)
          -&gt;setCellValue('A1', 'Date of Export')
          -&gt;setCellValue('B1', $now)
          -&gt;setCellValue('A3', 'Employee Name')
          -&gt;setCellValue('B3', ' Checkin-date')
          -&gt;setCellValue('C3', ' Checkin-time')
          -&gt;setCellValue('D3', ' Checkout-date')
          -&gt;setCellValue('E3', ' Checkout-time')
          //                        -&gt;setCellValue('F3', ' Total-time Spent')
          //                        -&gt;setCellValue('G3', ' Over-time')
          -&gt;setCellValue('F3', ' Early checkout-remarks')
          -&gt;setCellValue('G3', ' Late checkin-remarks');
  
  //                        Newly added statement below
  //                        -&gt;setCellValue('H3', ' Absent/Leave Remarks');
  $objPHPExcel-&gt;getActiveSheet()-&gt;getStyle('A1:B1')-&gt;getFont()-&gt;setBold(true);
  $objPHPExcel-&gt;getActiveSheet()-&gt;getStyle('A3:H3')-&gt;getFont()-&gt;setBold(true);
  $objPHPExcel-&gt;getActiveSheet()-&gt;fromArray($results, null, 'A5');
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('A')-&gt;setWidth(20);
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('B')-&gt;setWidth(15);
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('C')-&gt;setWidth(15);
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('D')-&gt;setWidth(15);
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('E')-&gt;setWidth(15);
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('F')-&gt;setWidth(45);
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('G')-&gt;setWidth(45);
  
  // Rename worksheet
  $objPHPExcel-&gt;getActiveSheet()-&gt;setTitle('Login-data-' . $now);
  
  
  // Set active sheet index to the first sheet, so Excel opens this as the first sheet
  $objPHPExcel-&gt;setActiveSheetIndex(0);
  
  
  // Redirect output to a client’s web browser (Excel5)
  header('Content-Type: application/vnd.ms-excel');
  header('Content-Disposition: attachment;filename="Login_data_' . $now . '.xls"');
  header('Cache-Control: max-age=0');
  // If you're serving to IE 9, then the following may be needed
  header('Cache-Control: max-age=1');
  
  // If you're serving to IE over SSL, then the following may be needed
  header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
  header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
  header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
  header('Pragma: public'); // HTTP/1.0
  
  $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
  $objWriter-&gt;save('php://output');
  exit;
  ?&gt;
  </code></pre>
  
  <p>I have been getting this error:</p>
  
  <p>This site can’t be reached</p>
  
  <blockquote>
    <p>The webpage at <a href="http://localhost/gbdportal-new/Export" rel="nofollow noreferrer">http://localhost/gbdportal-new/Export</a> might be
    temporarily down or it may have moved permanently to a new web
    address. ERR_INVALID_RESPONSE</p>
  </blockquote>
  
  <p>It is working fine with the live version currently running on the server. What could be the problem?</p>