PHP chmod() Function
Complete PHP Filesystem Reference
Definition and Usage
The chmod() function changes permissions of the specified file.
Returns TRUE on success and FALSE on failure.
Syntax
Parameter |
Description |
file |
Required. Specifies the file to check |
mode |
Required. Specifies the new permissions. The mode
parameter consists of four numbers:
- The first number is always zero
- The second number specifies permissions for the owner
- The third number specifies permissions for the owner's user group
- The fourth number specifies permissions for everybody else
Possible values (to set multiple permissions, add up the following
numbers):
- 1 = execute permissions
- 2 = write permissions
- 4 = read permissions
|
Example
<?php
// Read and write for owner, nothing for everybody else
chmod("test.txt",0600);
// Read and write for owner, read for everybody else
chmod("test.txt",0644);
// Everything for owner, read and execute for everybody else
chmod("test.txt",0755);
// Everything for owner, read for owner's group
chmod("test.txt",0740);
?>
|
Complete PHP Filesystem Reference
Learn XML with <oXygen/> XML Editor - Free Trial!
|
|
oXygen helps you learn to define,
edit, validate and transform XML documents. Supported technologies include XML Schema,
DTD, Relax NG, XSLT, XPath, XQuery, CSS.
Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!
Do you have any XML related questions? Get free answers from the oXygen
XML forum
and from the video
demonstrations.
Download a FREE 30-day trial today!
|
|