bool chmod (string $filename, int $mode)Parameters used: The chmod() function in PHP takes two parameters: filename and mode.
There are three possible values, and the following values can be added to set multiple permissions.
- 1 = Execute Permissions
- 2 = Write Permissions
- 4 = read permissions
Input: chmod ("gfg.txt", 0600); Output: true Input: chmod ("gfg.txt", 0644); Output: true Input: chmod ("gfg.txt", 0755); Output: trueThe following programs illustrate the chmod() function in PHP:Program 1 :
// Read and write owner permissions
chmod
(
"gfg. txt "
, 0600);
?>
Output:true Program 2 :
// Read and write permission for the owner,
/ / and read permission for everyone else
chmod
(
" gfg.txt "
, 0644);
?>
Output:true Program 3 :
// All rights to owner, read and
// grant permissions for everyone else
chmod
(
"gfg.txt"
, 0755);
?>
Output:true Link:
http://php.net/manual/ en / function.chmod.php