This is the code that creates the "cache" folder with the wrong permissions:
mkdir($saveFolder, 02775);
When I inspect the folder permissions, using ls -la
, I receive:
drwxr-sr-x
But instead I'm expecting:
drwxrwsr-x
For some obscure reasons (at least for me) changing the code to
mkdir($saveFolder);
chmod($saveFolder, 02775);
solved the issue.
Now I get the right permissions set on the folder:
drwxrwsr-x
Your current umask also affects the mode so depending on your umask settings, the mode of the created directory may not match the octal specified in your function call. http://php.net/manual/en/function.mkdir.php:
The mode is 0777 by default, which means the widest possible access. For more information on modes, read the details on the chmod() page. Note that you probably want to specify the mode as an octal number, which means it should have a leading zero. The mode is also modified by the current umask, which you can change using umask().
Try setting umask(0)
and the argument supplied to mkdir()
should work as expected.
More discussion here: https://bugs.php.net/bug.php?id=65796
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With