I am trying to unlink a file but keep getting a permission denied error.
The folder I am attempting to modify within has permissions 0775
I am trying to unlink file.pdf from unlink.php... The folder structure is as follows:
root / folder1(PasswordProtected) / unlink.php
root / folder2 / file.pdf
I have tried the following from unlink.php (but to no avail):
if(file_exists("../folder2/file.pdf"))
{
chmod("../folder2/file.pdf",0777);
unlink("../folder2/file.pdf");
}
I think my question is similar to permission denied - php unlink but honestly I just don't understand what I have to do...
Additional: If I change folder2
to 0777 in cPanel then I have no issues, but I don't want the public making changes to the file.. (is this correct? or have I misunderstood what 0777 does?)
Thanks for any help.!
Server side issue. Full description of issue was not provided by hosting company. Now resolved.