title: CORS: No 'Access-Control-Allow-Origin' header - but php sets header file
body: <p>I know that there are serveral questions about cors have been aksed/answered... But I did not find a solution for my issue...</p>
  
  <p>I receive the following error message in my js application (based on jquery/jquery mobile):</p>
  
  <p>Failed to load resource: the server responded with a status of 500 (Internal Server Error)</p>
  
  <p>XMLHttpRequest cannot load <a href="http://www.mydomain.de/api.php" rel="nofollow">http://www.mydomain.de/api.php</a>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'xyz' is therefore not allowed access. The response had HTTP status code 500</p>
  
  <p>PHP file starts with:</p>
  
  <pre><code>&lt;?php
  header("Access-Control-Allow-Origin: *");
  header("Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS");
  header("Access-Control-Max-Age: 86400");    // cache for 1 day
  ...
  </code></pre>
  
  <p>Part of the js code:</p>
  
  <pre><code>$.ajax({
   type:      'POST',
   crossDomain: true,    
   cache:         false,
   url:       "http://www.mydomain.de/api.php",
   data:      payload,
   dataType:  'json',
   success:   function(a,b,c) { }
  });
  </code></pre>
  
  <p>The php page is hosted at strato.de / php version 5.7</p>
  
  <p>Any solution?</p>