PHP.nl

chmod

chmod

Changes file mode

bool **chmod** string $filename int $permissions

Attempts to change the mode of the specified file to that given in . permissions

filenamePath to the file.

permissions Note that is not automatically assumed to be an octal value, so to ensure the expected operation, you need to prefix with a zero (0). Strings such as "g+w" will not work properly. permissions``permissions

  ```php




       The  parameter consists of three octal
       number components specifying access restrictions for the owner,
       the user group in which the owner is in, and to everybody else in
       this order. One component can be computed by adding up the needed
       permissions for that target user base. Number 1 means that you
       grant execute rights, number 2 means that you make the file
       writeable, number 4 means that you make the file readable. Add
       up these numbers to specify needed rights. You can also read more
       about modes on Unix systems with ''
       and ''.
      `permissions`


       
      ```php
<?php
// Read and write for owner, nothing for everybody else
chmod("/somedir/somefile", 0600);

// Read and write for owner, read for everybody else
chmod("/somedir/somefile", 0644);

// Everything for owner, read and execute for others
chmod("/somedir/somefile", 0755);

// Everything for owner, read and execute for owner's group
chmod("/somedir/somefile", 0750);
?>

return.success

Upon failure, an is emitted. E_WARNING

Opmerking: > The current user is the user under which PHP runs. It is probably not the same user you use for normal shell or FTP access. The mode can be changed only by user who owns the file on most systems.

chown``chgrp``fileperms``stat