clarkk
clarkk

Reputation: 27679

mkdir() is not setting chmod to 0777

Why does mkdir not set CHMOD to 0777?

mkdir('/var/www/test', 0777);

After the dir is made the CHMOD is set to 0755

from php.net

bool mkdir ( string $pathname [, int $mode = 0777 [, bool $recursive = false [, resource $context ]]] )

the $mode should be 0777 by default... but if you leave the second argument empty the CHMOD still is set to 0755

Upvotes: 3

Views: 5185

Answers (3)

dinopmi
dinopmi

Reputation: 2673

According to the mkdir PHP documentation:

The mode is also modified by the current umask, which you can change using umask().

Could this be the case?

Upvotes: 0

DarkDust
DarkDust

Reputation: 92316

Because it is influenced by the current umask. From the PHP mkdir documentation:

The mode is also modified by the current umask, which you can change using umask().

Upvotes: 0

user212218
user212218

Reputation:

From http://php.net/mkdir:

Note: mode is ignored on Windows.

The mode is also modified by the current umask, which you can change using umask().

Upvotes: 8

Related Questions