title: Best practices when using XML for PHP configuration?
body: <p>I was planning to use an XML document to store configuration for my next PHP project, in a format similar to ASP.NET Web.Config files. Just two concerns:</p>
  
  <ol>
  <li>Cannot be served to the browser.</li>
  <li>Must be viable in shared hosting.</li>
  </ol>
  
  <p>The best way I could think to prevent it from being served is to change the filetype to PHP and add the following comment:</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;!-- &lt;?php if(!defined('FW_LOADED')){ exit; } ?&gt; --&gt;
  &lt;configuration&gt;
  ....
  &lt;/configuration&gt;
  </code></pre>
  
  <p>This is working fine, but I don't feel like it is the best solution.</p>
  
  <p>Has anybody else used XML to store configuration for a PHP project? What are some good alternate solutions (instead of putting a comment at the beginning of the file which exits the script if a constant is not defined)?</p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>Changed the question title to better reflect what I'm looking for. Sorry for the misleading original question title. Using XML for configuration is <strong>not the question</strong>. I am asking for the best practices when using XML for configuration. <em>Please stop suggesting that I use arrays or INI files...</em></p>
  
  <p>I want the config file to be as easy as possible to use, even for non php developers. I chose XML because it is language neutral. I am already using SimpleXML to parse the config (partially). I am also not worried about compiling or making it faster because that can be achieved using memcached or other utilities.</p>
  
  <p>The best solutions so far are:</p>
  
  <ul>
  <li>Moving it out of web root.
  
  <ul>
  <li><em>Possible, but would like to keep the config as close as possible to the application.</em> </li>
  </ul></li>
  <li>Using htaccess to hide the config file.
  
  <ul>
  <li><em>I don't want to risk the chance that someone breaks the .htaccess file, leaving the config file exposed.</em></li>
  </ul></li>
  </ul>
  
  <p>I would like to hear from someone who has experience using XML for configuration settings in an application, and how they prevent the config file from being served.</p>