Warning Cannot modify header information - headers already sent
suggest changeAppearance :
Happens when your script tries to send an HTTP header to the client but there was already output, so the headers were already sent to the client.
Possible Causes :
- Print, echo: Output from print and echo statements will terminate the opportunity to send HTTP headers. The application flow must be restructured to avoid that.
- Raw HTML areas: Unparsed HTML sections in a .php file are direct output as well. Script conditions that will trigger a
header()call must be placed before any raw blocks.
<!DOCTYPE html>
<?php
// Too late for headers already.
- Whitespace before
<?phpfor “script.php line 1” warnings: If the warning refers to output in line 1, then it’s mostly leading whitespace, text or HTML before the opening<?phptoken.
<?php
# A space or newline before this opening tag is already output. It cannot be shown inside the fence.
Reference from SO answer by Mario
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents