PHP » I/O » chmod()

Syntax:
bool chmod(string filename, int permissions)
filename
The name of the file.
permissions
The new permissions.

Changes the permissions of a file.

The chmod() function changes the permissions of a file. See fileperms() for more information about permission encoding. TRUE is returned on success. If an error occurs, FALSE is returned.

Examples

Code:
<?php

if (chmod("file.txt", 0600)) {
   print "File permissions changed";
}

?>
Output:
File permissions changed
Explanation:

The permissions of a file are set to read and write for the owner, and no permissions for group and others.

See Also: