PHP - Change File Permissions on Linux Server
Posted: Wed Nov 10, 2010 3:30 am
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
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