PHP 创建的目录没有权限...?
刚刚发生了一些非常奇怪的事情,我不确定为什么。我们的网站崩溃了,因为 PHP 无法将缓存文件写入脚本自动创建的目录。当我调查时,我发现该目录没有权限:所有者、组或公共没有读或写权限。
该脚本每天创建目录数百次,没有任何问题。事实上,当我使用 sudo 并删除该目录时,它会立即使用正确的权限重新创建。
我从未见过完全没有权限的目录,所以我只是好奇这是怎么发生的。有什么想法吗?
Just had something really weird happen, and I'm not sure why. Our site crashed because PHP couldn't write a cache file to a directory which is created automatically by the script. When I investigated, I saw that the directory had NO permissions: no read or write for owner, group, or public.
This script creates directories hundreds of times a day, with no problems. Indeed, when I sudo'd and removed the dir, it was re-created with the correct permissions instantly.
I've never seen a directory with absolutely no permissions, so I'm just curious how that could have happened. Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来好像在 php 脚本停止运行之前目录没有解锁/关闭。您的脚本中是否有任何执行路径会导致这种情况?
Sounds like the directory wasn't unlocked/closed before the php script stopped running. Got any execution paths that would lead to this in your script?
对 mkdir 的调用是否设置了
$mode
参数?您是否在代码中的任何位置使用 umask 函数?Does the call to mkdir set the
$mode
parameter? Do you use the umask function anywhere in the code?