开发者

mkdir() not chmodding the directory

开发者 https://www.devze.com 2023-03-06 02:29 出处:网络
I\'m using the following code to create a directory... mkdir($basedir.$plan_name, 0777, 1); It creates, but the issue is that the 777 permissions aren\'t sticking

I'm using the following code to create a directory...

mkdir($basedir.$plan_name, 0777, 1);

It creates, but the issue is that the 777 permissions aren't sticking

Any ideas?

My directory structure is this开发者_如何学Python....

/pdf/customs (owned by wwwuser:user) /pdf/customs/417/Folder Name (created by code, modded to 755)


Your umask is probably 022. For more information, read man 2 mkdir. You must use chmod after you make the directory to set the permissions to 0777.

Edit: As others have suggested, you can change your umask instead. However, if something goes wrong, the umask will stick around and your webserver or fastcgi daemon (or whatever) will start creating world-writable files and directories. That's bad news.


Did you check your umask ?

The directory permissions will be modified by that. For example if your umask value is 002 the resulting permissions will be 0775.


From the documentation:

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().

What is your umask?

0

精彩评论

暂无评论...
验证码 换一张
取 消