Error file unreadable only from server

Topics: Developer Forum
Sep 2, 2014 at 4:28 AM
I've got my code running well on my local apache server but when I upload and try to call it in order to build an xlsx file from site the result is an unreadable xlsx. It seems to be something on my server so here are the specs:
  • Centos 6.5
  • Apache 2.2.15
  • PHP 5.4.32
  • GD 2.1.0
  • ZIP 1.11.0
  • XML 2.7.6
My builder code is under a controller method (MVC) which as I said works like a charm in local server.

Extract from the result:
Any help would be much appreciated!!
Sep 3, 2014 at 1:53 AM
Solved!!!! The problem was because of a break line inserted who knows how and why. The solution was to add these two lines that seems to get everything in order before you send the headers:

// Redirect output to a client’s web browser (Excel2007)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');