Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h3>Warning: Cannot modify header information - headers already sent</h3> <p>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.</p> <p>This is an <a href="http://www.php.net/manual/en/errorfunc.constants.php" rel="noreferrer"><code>E_WARNING</code></a> and it will not stop the script.</p> <p>A typical example would be a template file like this:</p> <pre><code>&lt;html&gt; &lt;?php session_start(); ?&gt; &lt;head&gt;&lt;title&gt;My Page&lt;/title&gt; &lt;/html&gt; ... </code></pre> <p>The <code>session_start()</code> function will try to send headers with the session cookie to the client. But PHP already sent headers when it wrote the <code>&lt;html&gt;</code> element to the output stream. You'd have to move the <code>session_start()</code> to the top.</p> <p>You can solve this by going through the lines <em>before</em> the code triggering the Warning and check where it outputs. Move any header sending code before that code. </p> <p>An often overlooked output is new lines after PHP's closing <code>?&gt;</code>. It is considered a standard practice to omit <code>?&gt;</code> when it is the last thing in the file. Likewise, another common cause for this warning is when the opening <code>&lt;?php</code> has an empty space, line, or invisible character before it, causing the webserver to send the headers and the whitespace/newline thus when PHP starts parsing won't be able to submit any header.</p> <p>If your file has more than one <code>&lt;?php ... ?&gt;</code> code block in it, you should not have any spaces in between them. (Note: You might have multiple blocks if you had code that was automatically constructed)</p> <p>Also make sure you don't have any Byte Order Marks in your code, for example when the encoding of the script is UTF-8 with BOM.</p> <p>Related Questions:</p> <ul> <li><a href="https://stackoverflow.com/questions/8028957/headers-already-sent-by-php">Headers already sent by PHP</a></li> <li><a href="https://stackoverflow.com/search?q=headers+already+sent+[php]">All PHP "Headers already sent" Questions on Stackoverflow</a></li> <li><a href="https://stackoverflow.com/search?q=BOM+php">Byte Order Mark</a></li> <li><a href="https://stackoverflow.com/questions/4673747/what-php-functions-create-output">What PHP Functions Create Output?</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload