Page 1 of 1
chmod for directory
Posted: Thu Apr 08, 2004 12:48 pm
by dsdsdsdsd
hello;
I am attempting to change the permissions on a directory;
I am trying to use chmod("dir_name" , 0777) but I get "Operation not permitted" warning;
in the php man it suggests that chmod is for files; if that is the case then is there a dir_chmod?
thanks
Shannon
Posted: Thu Apr 08, 2004 1:06 pm
by TheBentinel.com
The PHP process must have permission to do the chmod'ing. Was the directory created by a PHP script?
If you have FTP or telnet access, verify what owner and group the directory has. It should be the same and the owner and group of the PHP process. Otherwise, you'd get this error, essentially an "access denied" error.
Posted: Thu Apr 08, 2004 2:20 pm
by dsdsdsdsd
hello Dave;
no, the directory was not created by the script;
indeed, if I go in and manually change the directory to 0777, my script can get inside and unlink() all the files;
I have been looking at the stat() function:
the file , the directory
134407 , 134407 -------- device number
10656695 , 10656094 --------- inode number
33188 , 16877 ------------ inode protection mode
1 , 2 --------------- number of links
1910 , 1910 -------------- user id of owner
1910 , 1910 ------------- group id of owner
I have posted the first 6 results of stat() for the file.php and for the directory_I_am_trying_to_manipulate;
any thoughts?
dsdsdsdsd
Posted: Thu Apr 08, 2004 2:27 pm
by TheBentinel.com
If the directory wasn't created by the script, there's a good chance it won't be able to chmod it. Is "1910" the userid of the PHP process?
This is an O/S issue, you won't be able to solve it from PHP. If you need to be able to chmod the directory from the script, then the PHP process has to have permission to do it. Once that is resolved, your script will probably work.