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

前端 未结 6 1435
小鲜肉
小鲜肉 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:50

    For those who tried

    mkdir('path', 777);

    and it did not work.

    It is because, apparently, the 0 preceding the file mode is very important which tells chmod to interpret the passed number as an Octal instead of a decimal.

    Reference

    Ps. This is not a solution to the question but only an add-on to the accepted anwser

提交回复
热议问题