title: unlink cannot delete file
body: <p>I'm frustrated about deleting file in ubuntu using PHP unlink().</p>
  
  <p>I created a very simple simulation as follow:</p>
  
  <ol>
  <li>create a folder named "files" beneath /var/www with 766 permission.    </li>
  <li>upload a file, let say "image.png" in that folder &amp; set the permission into 666</li>
  <li>create a php file named delete.php, set the permission to 644 and upload to /var/www directory</li>
  <li>Call the file in browser (I use localhost)</li>
  </ol>
  
  <p>The "image.png" still exists in "files" directory</p>
  
  <p>Here is the php script of delete.php :</p>
  
  <pre><code>$filename = 'image.png';
  $file = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $filename;
  unlink($file);
  </code></pre>
  
  <p>I also tried the following script :</p>
  
  <pre><code>$filename = 'image.png';
  $dir = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'files';
  chdir($dir);
  unlink($filename);
  </code></pre>
  
  <p>But still can't delete the file.</p>