Page 1 of 1

chmod($file, 0777);

Posted: Fri Apr 04, 2003 5:21 pm
by phice
So, I've come to a few breaking points in my program, and I need a solution to CHMODing a file.

File name: test_file.php
File location: /home/nncommunity/www/phpFF/test_file.php

First, I've tried to do the normal

Code: Select all

<?php
chmod("/home/nncommunity/www/phpFF/test_file.php", 0777);
?>
And, of course, it produces an error stating "Warning: Permission denied...".

I search the Phuse search engine for chmod() help in the forums, and find that some people have been able to successfully chmod a file using exec(). I've tried that, and nope. Not working.

I really don't want to put in FTP support, that's the very last resort, and if I have to, I probably won't go there.

I'm trying to edit a file through a browser, and when I do fwrite("test_file.php", "w+"); is gives me the same "Permission denied".

Any help? Thoughts?

Posted: Fri Apr 04, 2003 8:24 pm
by bionicdonkey
do u have the user privileges for that file?? aka are u the owner of the file

Posted: Fri Apr 04, 2003 8:42 pm
by phice
What do you mean owner? I have full access from '/home/nncommunity/' and on, if that's enough ownership.

Posted: Fri Apr 04, 2003 10:35 pm
by phice
I've fixed my solution. :D Simply delete the file, then write the file (which will recreate the file).

The hardest of my problems always ends up being the simplest solution. You can quote me on that. ;)