At 02:13 PM 7/11/2005, you wrote:
Philip Hallstrom wrote:
Is there a way to change directory permissions with pre php5.0? Linux/Apache
I'm designing a CM application and would like my code to enable
non-techies to be able to create a simple text file. [e.g.,
directory temporarilly from 755 to 757 and then back again.]
PHP5.0 has a chmod; but not, 4.3.x
Huh? chmod has been around since V3...
http://us2.php.net/chmod
chmod
(PHP 3, PHP 4, PHP 5)
chmod -- Changes file mode
The key word is "directory"
chmod only works for files
PHP5 has a ftp_chmod; but not 4.3.x
Chmod does NOT "only" work for files. Not sure about pre 4.1.2, but
from 4.1.2 and up, it appears that on a linux/unix system, php's
chmod treats directories like they where files....for the most
part. My php code did not make the directory, but was run by the
user that did make the directory. Yes, I can see where there would
be a problem if the directory was created by one user and the php
script was executed by another user....like "apache". But in the
case where a user created a file with certain permissions and the
script was run by another user, like apache, then it is
understandable that php's chmod wouldn't work on it. That doesn't
mean that php's chmod will only work on files. It only means that it
has to have permission on the file to make the changes.
Steve
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php