mkdir() 不改变目录
我正在使用以下代码创建一个目录...
mkdir($basedir.$plan_name, 0777, 1);
它创建了,但问题是 777 权限没有坚持
有什么想法吗?
我的目录结构是这样的...
/pdf/customs (由 wwwuser:user 拥有) /pdf/customs/417/文件夹名称(由代码创建,修改为755)
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....
/pdf/customs (owned by wwwuser:user)
/pdf/customs/417/Folder Name (created by code, modded to 755)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的
umask
可能是022
。有关更多信息,请阅读man 2 mkdir
。创建目录后必须使用chmod
将权限设置为0777
。编辑:正如其他人所建议的,您可以更改您的umask。但是,如果出现问题,umask 将保留下来,并且您的网络服务器或 fastcgi 守护程序(或其他)将开始创建世界可写的文件和目录。这是个坏消息。
Your
umask
is probably022
. For more information, readman 2 mkdir
. You must usechmod
after you make the directory to set the permissions to0777
.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.
您检查过您的
umask
吗?目录权限将被修改。例如,如果您的 umask 值为
002
,则生成的权限将为0775
。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 be0775
.来自文档:
你的 umask 是什么?
From the documentation:
What is your umask?