title: Trouble saving an xml file using DOMDocument->save('filename')
body: <p>I have a short PHP program that loads an XML file (test02.xml) and then attempts to save it in another file.</p>
  
  <p>The program is:</p>
  
  <pre><code>&lt;?php
  //The next three lines are needed to open a file for writing on the server I use.
  
  $stream_options = array('ftp' =&gt; array('overwrite' =&gt; TRUE));
  $stream_context = stream_context_create($stream_options);
  $fxml = fopen("ftp://userid:password@www.yurowdesigns.com/public_html/programs/test03.xml","w",0,$stream_context);
  
  //The next three lines create a new DOMDocument, load the input file, "test02.xml"  
  //and attempt to save the loaded file in the output file "test03.xml"
  
  $doc = new DOMDocument;
  $doc-&gt;load("test02.xml");
  $doc-&gt;save("test03.xml");
  ?&gt;
  </code></pre>
  
  <p>The file test03.xml opens properly and is created if it does not exist. However, there is no output in it. The loaded file, test02.xml, is non-empty and well formed XML. I have loaded and read it successfully with other PHP programs.</p>
  
  <p>When I run the above program, I get the message:</p>
  
  <p>Warning: DOMDocument::save(test03.xml) [domdocument.save]: failed to open stream: Permission denied in /home/yurow/wwwroot/yurowdesigns.com/programs/xmlTest.php on line 8.</p>
  
  <p>I have checked the syntax of the 'save' command at:</p>
  
  <p>phpbuilder.com/manual/en/function.dom-domdocument-save.php</p>
  
  <p>and it appears to be correct. Any idea what is causing this???</p>