title: Can't open file in PHP
body: <p>I'm trying to open a file with <a href="http://en.wikipedia.org/wiki/PHP" rel="nofollow">PHP</a> for write access:</p>
  
  <pre><code>$myFile = "all.txt";
  $fh = fopen($myFile, 'w') or die("can't open file");
  </code></pre>
  
  <p>My browser is spitting back:</p>
  
  <blockquote>
    <p>can't open file</p>
  </blockquote>
  
  <p>I've tried to chmod -R 777 the folder where this PHP file is as well as where $myFile (a text file) sits. What else could be the problem?</p>
  
  <p>It ends up being that there are permission errors when I turn error reporting on. When I do <code>ls -la all.txt</code>, I get <code>-rwx------  1 Myname  staff  0 Nov  8 15:11 all.txt</code></p>