Today I learned that PHP’s mkdir()
with the octal permission argument apparently doesn’t support any value other than 0
in the leftmost octal spot (where setuid, setgid, and sticky bit go). If you try something like 2755
or '2755'
, it will interpret it as or typecast it to an integer, and your permissions will end up very different than what you want. An octal in PHP is just a special language format to define a regular integer, where you put a 0
at the beginning of a number. So 02755
is the PHP octal to match octal 2755
. This sets the 755
correctly, but it still doesn’t handle the 2
spot at all. I’m not sure why. I guess that has to be done after the fact.