mkdir() in php is not setting the folder permission to 0777 [duplicate]
Possible Duplicate:
PHP code mkdir('images','0777') creates a folder with 411 permissions! Why?
I am trying to create a folder on my server using php i have been trying this and it is not working it set it 开发者_如何学Pythonto 411 does anyone know why this is happening?
mkdir($create_path, "0777");
i have also tryed chmod but i am getting a safe mode error.
chmod($create_path, '0777');
Both chmod() and mkdir() accept an integer for $mode. It is easier to use octal numbers in that case:
mkdir('/path', 0777); // using octal
mkdir('/path', 511); // same thing as previous but using decimal
Be careful and make sure you prepend your mode (i.e.: 777) with a 0 to tell the parser to use octal. Omitting the 0 will make it use decimal and will give a different result.
Since '0777' (string) is converted to decimal 777, it is not the same mode as 0777.
Second parameter should be integer as you can see here. so use this one
mkdir($create_path, 0777); // it should works!
精彩评论