24.3.1. ProblemYou want to change a file's permissions or ownership; for example, you want to prevent other users from being able to look at a file of sensitive data. 24.3.2. SolutionUse chmod( ) to change the permissions of a file, as shown in Example 24-10. Changing file permissions
Use chown( ) to change a file's owner and chgrp( ) to change a file's group. These are shown in Example 24-11. Changing file owner and group
24.3.3. DiscussionThe permissions passed to chmod( ) must be specified as an octal number. The superuser can change the permissions, owner, and group of any file. Other users are restricted. They can change only the permissions and group of files that they own, and can't change the owner at all. A non-superuser can also change only the group of a file to a group to which the user belongs. The functions chmod( ), chgrp( ), and chown( ) don't work on Windows. 24.3.4. See AlsoDocumentation on chmod( ) at http://www.php.net/chmod, chown( ) at http://www.php.net/chown, and chgrp( ) at http://www.php.net/chgrp. |