CHMOD(3)								 1								  CHMOD(3)

chmod - Changes file mode

bool chmod (string $filename, int $mode) DESCRIPTION
Attempts to change the mode of the specified file to that given in $mode. PARAMETERS
o $filename - Path to the file. o $mode - Note that $mode is not automatically assumed to be an octal value, so to ensure the expected operation, you need to prefix $mode with a zero (0). Strings such as "g+w" will not work properly. <?php chmod("/somedir/somefile", 755); // decimal; probably incorrect chmod("/somedir/somefile", "u+rwx,go+rx"); // string; incorrect chmod("/somedir/somefile", 0755); // octal; correct value of mode ?> man 1 chmod' and ' man 2 chmod'. <?php // Read and write for owner, nothing for everybody else chmod("/somedir/somefile", 0600); // Read and write for owner, read for everybody else chmod("/somedir/somefile", 0644); // Everything for owner, read and execute for others chmod("/somedir/somefile", 0755); // Everything for owner, read and execute for owner's group chmod("/somedir/somefile", 0750); ?> RETURN VALUES
Returns TRUE on success or FALSE on failure. NOTES
Note The current user is the user under which PHP runs. It is probably not the same user you use for normal shell or FTP access. The mode can be changed only by user who owns the file on most systems. Note This function will not work on remote files as the file to be examined must be accessible via the server's filesystem. Note When safe mode is enabled, PHP checks whether the files or directories you are about to operate on have the same UID (owner) as the script that is being executed. In addition, you cannot set the SUID, SGID and sticky bits. SEE ALSO
chown(3), chgrp(3), fileperms(3), stat(3). PHP Documentation Group CHMOD(3)

Featured Tech Videos