
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tlug] Arrrg! Permissions driving me nuts in PHP
- Date: Tue, 23 Nov 2010 13:44:24 +0900
- From: Dave M G <dave@example.com>
- Subject: [tlug] Arrrg! Permissions driving me nuts in PHP
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6
TLUG,
In a PHP script I have, I use mkdir() to create a directory and put some
files in it.
It's just a temporary directory to organize some files that I bundle
into a tar.gz file and store away.
After I've got the tar file made, I want to delete the temp directory. I
use the code included at the bottom (which I took from the PHP manual
site) to recursively delete the directory and its subdirectories and files.
However, when I run the code, I get permission errors:
Warning: unlink(/home/site/public_html/+backup/someFileOrOther)
[function.unlink]: Permission denied in
/home/site/public_html/backup.php on line 115
How can a directory I just made a few lines earlier in a PHP script have
permissions that don't permit the very same script that created it to
delete it a few lines later?
More importantly, how do I remove the $%&#ing thing?
Thanks for any advice. The aforementioned delete function is included
below for reference:
function rrmdir($dir)
{
if (is_dir($dir))
{
$objects = scandir($dir);
foreach ($objects as $object)
{
if ($object != "." && $object != "..")
{
if (filetype($dir . "/" . $object) == "dir")
rrmdir($dir . "/" . $object); else
unlink($dir . "/" . $object);
}
}
reset($objects);
rmdir($dir);
}
}
--
Dave M G
Home |
Main Index |
Thread Index