PHP - Function chmod()
bool chmod ( string $filename, int $mode );
Definition and Usage
Attempts to change the mode of the specified file to that given in mode.
|path||A file path.|
|mode||Note that mode is not automatically assumed to be an octal value, so strings (such as "g+w") will not work properly. To ensure the expected operation, you need to prefix mode with a zero (0) −|
Returns TRUE on success or FALSE on failure.
Following is the usage of this function −
<?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); ?>