Deleting a directory created with the wrong ownership
<p>My script creates a directory. Before I realized that I needed to <code>chown()</code> the directory from apache to my user name so that I could access the uploaded files, I ran the script a few times.  Now I can't seem to get rid of the directory so I can start clean.  </p>

<p>I figured that all I needed to do was write a PHP script to do is since within the script I would 'be' apache.  I've tried <code>rmdir</code> and <code>chown</code> but I keep getting <code>permission denied</code>.  I even tried loading the file in browser instead of just <code>php file.php</code> at the command line in case that affects the effective user.</p>

<p>What else can I try?</p>

<hr>

<p>I already realized invoking the script from the command line would run it with my username as the user instead of the username that the web server runs it as (<code>apache</code>) so I've been invoking the script through the browser.  I've been simply trying to chown it to my user name so that I can delete it from the command line instead of trying to write some recursive <code>rmdir</code> function.</p>

<pre><code>&lt;?php
   $target = "/some/absolute/file/path";
   chown($target, "myself");
?&gt;
</code></pre>
