title: Why browser is trying to download my php script file?
body: <p>Just a quick one - I wrote a php script recently that dynamically creates XML file using API DOM. So I'm using this at the beginning:</p>
  
  <pre><code>$dom = new DOMDocument('1.0', 'UTF-8');
  </code></pre>
  
  <p>And at the end it looks like this:</p>
  
  <pre><code>$server = $_SERVER['DOCUMENT_ROOT'];
  $path_to_xml = "$server/project/file.xml"; 
  file_put_contents($path_to_xml, $dom-&gt;saveXML());
  </code></pre>
  
  <p>It does everything I wanted but why browser is trying to download this php script instead of just run it? Please can someone help me with this. I'm pretty sure it's something easy.
  //-----------------------------------edited
  Thanks for all replies. Yes I'm sending custom headers because it's google maps kml file that I'm creating dynamically. </p>
  
  <p>header('Content-type: application/vnd.google-earth.kml');</p>
  
  <pre><code>// Creates the root KML element and appends it to the root document.
  $node = $dom-&gt;createElementNS('http://earth.google.com/kml/2.0', 'kml');
  $parNode = $dom-&gt;appendChild($node);
  </code></pre>
  
  <p>Could that be possible cause of this?</p>