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.
|Sr.No||Parameter & Description|
A file path.
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("hello.txt", 0600); // Read and write for owner, read for everybody else chmod("hello.txt", 0644); // Everything for owner, read and execute for others chmod("hello.txt", 0755); // Everything for owner, read and execute for owner's group chmod("hello.txt", 0750); ?>