session_start() followed by header() causing error
<p>I have the following code in a PHP file called via Ajax (note - the code is a stripepd down version of the actual code, but still produces an error:</p>

<pre><code>&lt;?php
    session_start();
    $response = array(
        'status'=&gt;'abc',
        'a'=&gt;'abc',
        'b'=&gt;'abc',
        'c'=&gt;'abc'
    );

    header('X-JSON: '.json_encode($response));
    exit;
</code></pre>

<p>?></p>

<p>There are absolutely no spaces or anything before the opening 

<p>Yet when I call the script I get:</p>

<blockquote>
  <p>'[11-Aug-2009 14:56:13] PHP Notice:  A
  session had already been started -
  ignoring session_start() in
  \test\action.php on line 2</p>
  
  <p>[11-Aug-2009 14:56:13] PHP Warning: 
  Cannot modify header information -
  headers already sent by (output
  started at \test\action.php:2) in
  \test\action.php on line 10'</p>
</blockquote>

<p>Line 2 is the session_start() command and line 10 is the header() command.</p>

<p>So PHP is telling me that it has ignored the session_start, and then immediately telling me that actually that line produced output....whats going on?</p>
