title: How to get data from PUT request using PHP 5.4 on Apache 2.2
body: <p>I've tried all of them methods on could find that have worked for other folks, but with no luck.</p>
  
  <p>Here's my PHP code:</p>
  
  <pre><code>parse_str(file_get_contents("php://input"), $put_data);
  echo "foo is: " . $put_data['foo'] . "\n";
  </code></pre>
  
  <p>No matter what I try, I get 'foo is: '</p>
  
  <p>I'm thinking this is specific to Apache as running the same script on an nginx server shows the expected 'foo is: bar'</p>
  
  <p>Things I've tried with no change in the result: </p>
  
  <p>Changing my Content-Type header to application/x-www-form-urlencoded.</p>
  
  <p>Adding a LimitExcept directive to my apache config, like so (yes, I restarted after making the change)</p>
  
  <pre><code>&lt;Directory "/MyApp/Directory/"&gt;
      Allow From All
      AllowOverride All
      &lt;LimitExcept GET POST PUT OPTIONS DELETE&gt;
          Deny from All
      &lt;/LimitExcept&gt;
  &lt;/Directory&gt;
  </code></pre>
  
  <p>Using stream_get_contents like so:</p>
  
  <pre><code>$put_data = fopen("php://input", "r");
  $data = stream_get_contents($put_data);
  echo "data is: " . $data;
  fclose($put_data);
  </code></pre>
  
  <p>Here are the response headers:</p>
  
  <pre><code>Date: Wed, 11 Jun 2014 04:03:09 GMT
  Server: Apache/2.2.26 (Unix) DAV/2 PHP/5.4.24 mod_ssl/2.2.26 OpenSSL/0.9.8y
  X-Powered-By: PHP/5.4.24
  Expires: Thu, 19 Nov 1981 08:52:00 GMT
  Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
  Pragma: no-cache
  Content-Length: 7
  Keep-Alive: timeout=5, max=100
  Connection: Keep-Alive
  Content-Type: text/html; charset=utf-8
  </code></pre>
  
  <p>Thanks to any who can offer help.  Pulling what's left of my hair out on this one for hours now.</p>