i have a little system that creates dirs and uploads files to them .. when the dirs are created the permissions are
0777 or drwxrwxrwx
i also have a function that deletes everything inside the directory and then the directory itself...this works fine in my test environemnt (linux / apache) but on the production server (also linux / apache w apache2.0 filter) it deletes all the files in the directory but gives me a directory not empty error:
Warning: rmdir(../../../sections/portfolio/37): Directory not empty
i checked the dir and it is in fact empty, but the really strange thing is that the permissions are now changed to:
1411 or dr---x--t
can anyone help me out with this? i've never encountered this problem before...really weird.
here is the rmdir function (works fine in test server and many others..)
function delete_dir($file) {
if (file_exists($file)) {
chmod($file, 0777);
if (is_dir($file)) {
$handle = opendir($file);
while($filename = readdir($handle)) {
if ($filename != "." && $filename != "..") {
delete_dir($file."/".$filename);
}
}
closedir($handle);
rmdir($file);
} else {
unlink($file);
}
}
}