Sending HTTP headers or redirects after HTML output or whitespace has been sent to client.
PHP sends HTTP response headers automatically on the first piece of body output. Calling `header()`, `setcookie()`, or `session_start()` afterwards triggers this warning.
Accidental whitespace or UTF-8 BOM characters before the opening `<?php` tag, or printing `echo` output prior to `header("Location: ...")`.
1<?php2echo "Navigating to dashboard...";3 4// Bug: Headers already sent by echo statement above!5header("Location: /dashboard.php");6exit;1<?php2// Fix: Perform redirect logic before any output3if ($userLoggedIn) {4 header("Location: /dashboard.php");5 exit;6}7 8echo "Navigating to dashboard...";Simulate standard system builds to trigger compiler trace records and track memory crashes locally.
`echo` forces PHP to flush HTTP headers to the browser. Subsequent calls to `header()` fail because headers are already transmitted.