title: Can you write files in a different directory using PHP?
body: <p>If I have a PHP-driven CMS on <code>C:\wamp\www\cms</code> (alias <code>http://localhost/cms</code>) and I want to write <code>log.txt</code> to say <code>Z:\MySite\logs</code>, is that possible using PHP? <code>file_put_contents()</code>? What if <code>Z:\</code> is a network drive?</p>
  <h2>What I've tried</h2>
  <p><code>file_put_contents(&quot;Z:/MySite/logs/log.txt&quot;,$log);</code></p>
  <p>And I got:</p>
  <p><code>Warning: file_put_contents(Z:/Mysite/logs/log.txt): failed to open stream: No such file or directory in C:\wamp\www\cms\compiler.php on line 96</code></p>
  <p><strong>edit:</strong></p>
  <p><code>Z:/MySite/logs</code> directory does exist and I have r/w access, though it is on a network drive. (My intention is to dev on my local Apache (C:/) installation then output a preview directly to my network (Z:/) drive so my teammates can view it.) The warning I get (above) seems to indicate it is searching for the Z:\MySite[...] directory <em>inside</em> my C:/wamp[...] directory. I'm stuck.</p>