Output raw XML using php
<?php
header('Content-Type: application/xml');
$output = "<root><name>sample_name</name></root>";
print ($output);
?>
By default PHP sets the Content-Type to text/html, so the browsers are displaying your XML document as an HTML page.
For the browser to treat the document as XML you have to set the content-type:
header('Content-Type: text/xml');
Do this before printing anything in your script.