Why can't PHP create a directory with 777 permissions?

前端 未结 6 1436
小鲜肉
小鲜肉 2020-11-27 12:07

I\'m trying to create a directory on my server using PHP with the command:

mkdir(\"test\", 0777);

But it doesn\'t give full permissions, on

6条回答
  •  臣服心动
    2020-11-27 12:55

    The creation of files and directories is affected by the setting of umask. You can create files with a particular set of permissions by manipulating umask as follows :-

    $old = umask(0);
    mkdir("test", 0777);
    umask($old);
    

提交回复
热议问题