I'm on linux and I'm trying to delete a file. But, I continue to receive permission errors. I've tried using both chown
and chmod
and setting both to 666, 777 and 0777, and unlink($file, 0777) with no success. Is there something I'm missing?
$path = scandir('../folder1/folder2');
$file = realpath('../folder1/folder2/'.$path[2]);
//chown($file, 0777);
//chmod($file, 0777);
if (!unlink($file)))
{
echo ("Error deleting $path[2]");
}
else
{
echo ("Deleted $path[2]");
}