title: fopen() fails to open stream: permission denied, yet permissions should be valid
body: <p>So, I have this error:</p>
  
  <pre><code>Warning: fopen(/path/to/test-in.txt) [function.fopen]: failed to open stream: Permission denied
  </code></pre>
  
  <p>Performing <code>ls -l</code> in the directory where <code>test-in.txt</code> is produces the following output:</p>
  
  <pre><code>-rw-r--r-- 1 $USER $USER 1921 Sep  6 20:09 test-in.txt
  -rw-r--r-- 1 $USER $USER    0 Sep  6 20:08 test-out.txt
  </code></pre>
  
  <p>In order to get past this, I decided to perform the following:</p>
  
  <pre><code>chgrp -R www-data /path/to/php/webroot
  </code></pre>
  
  <p>And then did:</p>
  
  <p><code>chmod g+rw /path/to/php/webroot</code></p>
  
  <p>Yet, I still get this error when I run my php5 script to open the file. Why is this happening? I've tried this using LAMP as well as cherokee through CGI, so it can't be this.</p>
  
  <p>Is there a solution of some sort?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I'll also add that I'm just developing via localhost right now.</p>
  
  <p><strong>Update - PHP <code>fopen()</code> line</strong></p>
  
  <pre><code>$fullpath = $this-&gt;fileRoot . $this-&gt;fileInData['fileName'];
  
  $file_ptr = fopen( $fullpath, 'r+' );
  </code></pre>
  
  <p>I should also mention I'd like to stick with Cherokee if possible. What's this deal about setting file permissions for Apache/Cherokee?</p>