File write permissions error
Posted: Wed Jan 11, 2006 6:09 am
I've got a config file frmo a third party tool running on my Linux box, which I want to write single lines to the end of.
Here's my script:
I have another small script that reads the file, for purely information sake, to see the users listed.
However, everytime I try and write to it, I get the error file not writable.
Can someone point me in the direction of what file permissions I need - I have tried jsut chmod 777, but this didn't resolve it; in fact it caused a different error: cannot open file!
Any help would be greatly appreciated!
Thanks
Nunners
Here's my script:
Code: Select all
$user=" s/".$_GET["User_ID"].";".$_GET["Name"];
if (is_writable($filename_users)) {
if (!$handle = fopen($filename_users, 'a+')) {
echo "Cannot open file ($filename_users)";
exit;
}
if (fwrite($handle, $user) === FALSE) {
echo "Cannot write to file ($filename_users)";
exit;
}
echo "Success, wrote ($user) to file ($filename_users)";
fclose($handle);
} else {
echo "The file $filename_users is not writable";
}However, everytime I try and write to it, I get the error file not writable.
Can someone point me in the direction of what file permissions I need - I have tried jsut chmod 777, but this didn't resolve it; in fact it caused a different error: cannot open file!
Any help would be greatly appreciated!
Thanks
Nunners