PHP 创建的目录没有权限...?

发布于 2024-09-02 04:01:14 字数 211 浏览 1 评论 0原文

刚刚发生了一些非常奇怪的事情,我不确定为什么。我们的网站崩溃了,因为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌若浮生 2024-09-09 04:01:14

听起来好像在 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?

菊凝晚露 2024-09-09 04:01:14

mkdir 的调用是否设置了 $mode 参数?您是否在代码中的任何位置使用 umask 函数?

Does the call to mkdir set the $mode parameter? Do you use the umask function anywhere in the code?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文