Warning Cannot modify header information - headers already sent

suggest change

Appearance :

Happens when your script tries to send a HTTP header to the client but there already was output before, which resulted in headers to be already sent to the client.

Possible Causes :

  1. 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.
  2. 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 noted before any raw blocks.
<!DOCTYPE html>
<?php
     // Too late for headers already.
  1. Whitespace before <?php for “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 <?php token.
<?php
# There's a SINGLE space/newline before <? - Which already seals it.

Reference from SO answer by Mario

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Compilation errors and warning:
* Warning Cannot modify header information - headers already sent

Table Of Contents
2 Arrays
4 Types
10 Cookies
14 JSON
15 SOAP
17 cURL
19 XML
21 Traits
35 UTF-8
36 URLs
38 PHPDoc
41 Loops
44 Closur
56 Compilation errors and warning
72 YAML
77 Cache
78 Streams
81 PDO
82 SQLite3
83 Sockets
87 MongoDB
93 IMAP
94 Redis
95 Imagick
102 APCu
108 PSR