Forum Bugs

Cannot Modify Header Error

dvalle
Hello,

I am getting an error that starts like this "Warning: Cannot modify header information - headers already sent by…".

This is then followed by a long scrolling page of gibberish text.

The same file works on another machine. Currently I have a fresh install of Mac OS High Sierra.

I can't figure out what I could be missing. Any ideas?
  1. screen-shot.png312.0 kB
mikeday
The PHP script has already sent the headers, so it is unable to specify Content-type: application/pdf, so the browser is interpreting the PDF as text or HTML.
dvalle
Any suggestion on how to fix?
mikeday
Find where the headers are being set in the PHP script, perhaps by searching for "Content-type" or "text/html".
dvalle
It's located in the footer, however this was working before I started with a clean machine. The code hasn't changed. Maybe it's a PHP 7 thing?
mikeday
The footer? You will need to set Content-type before emitting any of the HTML.