title: file_put_contents - failed to open stream: Permission denied
body: <p>I am trying to write a query to a file for debugging. The file is in <code>database/execute.php</code>. The file I want to write to is <code>database/queries.php</code>.</p>
  
  <p>I am trying to use <code>file_put_contents('queries.txt', $query)</code></p>
  
  <p>But I am getting </p>
  
  <blockquote>
    <p>file_put_contents(queries.txt) [function.file-put-contents]:
    failed to open stream: Permission
    denied</p>
  </blockquote>
  
  <p>I have the <code>queries.txt</code> file chmod'd to 777, what could the issue be?</p>