PHP Manual
Prev |  | Next

# chmod

chmod -- Change file mode

## Description

`int chmod`(string filename, int mode);

Attempts to change the mode of the file specified by `filename` to that given in `mode`.

Note that `mode` is not automatically assumed to be an octal value. To ensure the expected operation, you need to prefix `mode` with a zero (0):

      1
      2 chmod( "/somedir/somefile", 755 );   // decimal; probably incorrect
      3 chmod( "/somedir/somefile", 0755 );  // octal; correct value of mode
      4

Returns true on success and false otherwise.

See also chown() and chgrp().

> Note: This function does not work on Windows systems

Prev | Home | Next
chgrp | Up | chown