Wont it be simpler without chmod($dir, 6750)
?
$old = umask(0);
mkdir($path, 06750);
umask($old);
And one more thing your mode value should start from 0. Read manual about mode possible values.
题
The question itself it quite simple, but it's really driving me crazy... I've read many other questions on Stack, but no matter how I change the code, the problem keeps occurring...
Why does...
if(!is_dir($dir)){
clearstatcache();
$mask = umask(0);
if(mkdir($dir, 6750)) chmod($dir, 6750);
umask($mask);
}
... produces...
d--s-wxrwT 2 owner group 4096 Jan 27 20:22 dir/
... when $dir
is the absolute path to the newly created dir/
?
As you can see, even though I request a 6750 permissions set, I get a lovely, yet useless, 5136... (the user and group, however, are correct) Here's what I've done :
And here's what I know :
chmod 6750
succesfully, getting proper results.Any reason why it seems like PHP forgot how to calculate ? Some questions mentionned an additional Apache2 parameters messing around, yet I cannot figure out which one...
解决方案
Wont it be simpler without chmod($dir, 6750)
?
$old = umask(0);
mkdir($path, 06750);
umask($old);
And one more thing your mode value should start from 0. Read manual about mode possible values.