文件权限可能与 php 中 mkdir 的参数不匹配的原因?
我正在尝试调试一个涉及 php 的奇怪文件权限问题,并且已经解决了明显的问题。请注意,我对 php 没有经验,所以这可能是显而易见的事情。
我希望用户能够通过 Web 界面创建文件夹和文件,并能够从服务器上的单独用户帐户使用这些文件来进行某些后端工作。问题是创建的文件夹和文件对于其他用户没有写入或执行权限。
我在这方面没有太多知识,所以我最好的黑客尝试是看看是否显式地将 0777(即使它是默认值)传递到相关的 mkdir 修复了它。以及其他所有 mkdir 调用。以及每个 chmod 调用。
据我所知,应该使用正确的权限创建文件夹和文件。有谁知道权限可能与我天真的期望不同的原因?
I'm trying to debug a strange file permission issue involving php, and have exhausted the obvious problems. Note that I'm not experienced with php, so it might be something dead-obvious.
I want the user to be able to create a folder and files via a web interface, and to be able to work with those files from a separate user account on the server for some backend work. The problem is that the created folders and files have no write or execute permissions for other users.
I don't have a lot of knowledge in this area, so my best hacky try was to see if explicitly passing 0777, even though it's the default, to the relevant mkdir fixed it. And also to every other mkdir call. And every chmod call.
As far as I can tell, the folder and files SHOULD be created with the right permissions. Does anyone know reasons the permissions might differ from what I naively expect?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果这是 UNIX,您需要检查 Web 服务器用户的 UMASK,如果这是 Windows,则它会忽略权限。
http://us.php.net/umask
if this is UNIX you need to check the UMASK for the web server user, if this is windows, it ignores the permissions.
http://us.php.net/umask