Hi,
I've been reading all over the i-net and could not find a solution to my problem here:
I'm accessing a php script in the backend admin part of my web application VIA WEB BROWSER which tries to delete a file.
I get permission denied errors.
I try to change permissions on the file but it won't let me.
Here's my code:
if(is_file($file_path))
{
// change file permissions
chmod($file_path, 0777);
// delete file
if(unlink($file_path))
{
echo "<p>file deleted !</p>";
}
else
{
echo "<p>file NOT deleted !</p>";
}
}
else
{
echo "<p>file does NOT exist !</p>";
}
Current file permissions are 644.
Any idea what I need to do ?
Thanx in advance for your help !
- M
PHP - Change File Permissions on Linux Server
Moderator: General Moderators
Re: PHP - Change File Permissions on Linux Server
Could you give us the specific error you're getting?
Try changing the permissions to 0777 of the file you're deleting (I doubt this will make any difference).
Try changing the permissions of the file you're using to delete to 0777, this is more likely to work.
Failing that it might be a user/group issue, but we can't tell that without a specific error and more details.
Try changing the permissions to 0777 of the file you're deleting (I doubt this will make any difference).
Try changing the permissions of the file you're using to delete to 0777, this is more likely to work.
Failing that it might be a user/group issue, but we can't tell that without a specific error and more details.
Re: PHP - Change File Permissions on Linux Server
mike,
thanx for ypur reply.
I already tried to set the file permission of the file that is trying to delete the .zip file to 0777, does not do the job.
the error the server throws is:
regarding chmod(): "Operation not permitted in ... "
regarding unlink(): "Permission denied in ... "
Thanx.
thanx for ypur reply.
I already tried to set the file permission of the file that is trying to delete the .zip file to 0777, does not do the job.
the error the server throws is:
regarding chmod(): "Operation not permitted in ... "
regarding unlink(): "Permission denied in ... "
Thanx.
Re: PHP - Change File Permissions on Linux Server
Who is the owner of the file and directory?
There are 10 types of people in this world, those who understand binary and those who don't