1

I am using mkdir in PHP to create a directory if it doesn't exist. However it seems to be failing to set the write part of the permissions.

mkdir('/path/to/directory/', 0775, true);

Looking at this us ls -l in shell shows that the directory has drwxr-xr-x the write permissions for group have not been set.

Even if I try to set 0777 permissions the write is not set for both group and everyone.

Is there something I am missing?

Edward144
  • 467
  • 1
  • 5
  • 14
  • 2
    do you have [umask](http://man7.org/linux/man-pages/man2/umask.2.html) configured? – Tom M Feb 26 '20 at 10:27
  • 1
    No I wasn't aware of umask, setting umask(0) has worked. Thanks! – Edward144 Feb 26 '20 at 10:31
  • Also, does your file system support traditional unix permissions? The mode parameter probably will not work on nfts and, according to the [docs](https://www.php.net/manual/en/function.mkdir.php#refsect1-function.mkdir-parameters) is ignored on windows – Tom M Feb 26 '20 at 10:31
  • 3
    Does this answer your question? [Why can't PHP create a directory with 777 permissions?](https://stackoverflow.com/questions/3997641/why-cant-php-create-a-directory-with-777-permissions) – Tom M Feb 26 '20 at 10:34

0 Answers0