-1

We all have encountered Headers already sent error probably. But I wonder if there's a way to find out what headers were sent?

jayarjo
  • 16,124
  • 24
  • 94
  • 138
  • that just means that A response was already triggered... sometimes, this can be caused by just having a space outside of the tags where you aren't expecting it – andersryanc Oct 28 '20 at 07:12
  • 2
    you tagged this with both PHP and node... what are you using? – andersryanc Oct 28 '20 at 07:12
  • thats probably your script already send a response and then set a header – Illya Oct 28 '20 at 07:15
  • Does this answer your question? [How to fix "Headers already sent" error in PHP](https://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php) – Luuk Oct 28 '20 at 07:28
  • No. I wonder if there's a way to find out what exactly has been sent already. – jayarjo Oct 28 '20 at 07:37
  • from php to node or node to php ?? – Alaa Kaddour Oct 28 '20 at 07:50
  • Ensure that the first characters are with no blank lines or spaces after it. – Alaa Kaddour Oct 28 '20 at 07:51
  • You can use [headers_sent()](https://www.php.net/manual/en/function.headers-sent.php) to check if/where headers have been sent and [headers_list()](https://www.php.net/manual/en/function.headers-list.php) to get a list of headers sent (or ready to send) – brombeer Oct 28 '20 at 08:25

1 Answers1

0

You can also use the ob_start(); on this page at the begging of the line after <?php tag.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197