title: PHP 5.3 getallheaders
body: <p>I'm developing a web application for which it is required to capture custom header data sent by clients. In my localhost PHP 5.4 was installed and I'm using <code>getallheaders()</code>.</p>
  
  <p>But in my hosting which has PHP 5.3 installed. I can't get the header. I already tried other ways such:</p>
  
  <pre><code>foreach ($_SERVER as $name =&gt; $value) 
  { 
      if (substr($name, 0, 5) == 'HTTP_') 
      {
          $name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5))))); 
          $headers[$name] = $value; 
      } else if ($name == "CONTENT_TYPE") { 
          $headers["Content-Type"] = $value; 
      } else if ($name == "CONTENT_LENGTH") { 
          $headers["Content-Length"] = $value; 
      } 
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>apache_request_headers(), apache_response_headers()
  </code></pre>
  
  <p>Is there any other way? My hosting is using PHP 5.3 (FastCGI).</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Well, i got where the problem came from. so first(for proofing the concept), i switch the PHP to run as Apache module, and yes as expected i able to use <code>getallheaders()</code>.</p>
  
  <p>after that i tried other rest client/debuger to send custom header(now as FastCGI), and my code is able capture the header(inside $_SERVER). So the question is, why the first REST client able to send header only if the server run as Apache Module.</p>
  
  <p>I'm afraid if one of my user got the same problem while the other is fine.</p>