警告:touch():Utime 失败:权限被拒绝 [英] Warning: touch(): Utime failed: Permission denied
问题描述
我正在将会话写入临时文件,如下所示:
I am writing the session to a temporary file as follows:
if ($_SESSION['user_login_status'] == 1)
{
touch("tmp/access-" . session_id());
}
我在 tmp 上设置了以下权限只是为了测试它是否正常工作(我会在测试时修改权限以使其更具限制性):
I have the following permissions set on tmp just to test it is working (I will modify permissions to be more restrictive as I test):
drwxrwxrwx+
我收到以下错误:
Warning: touch(): Utime failed: Permission denied
有什么想法吗?到目前为止我用谷歌搜索的所有内容都说检查权限(完成)或与我没有运行的 wordpress 错误有关.谢谢!
Any thoughts? Everything I have googled thus far says check the permissions (done) or is related to a wordpress error which I am not running. Thanks!
推荐答案
我显示了相同的错误消息(但代码片段不同).为我解决的是更改文件的所有者,即 chown uname:uname filename
.
I had the same error message show up (but a different code snippet). What solved it for me was to change the owner for the file, i.e. chown uname:uname filename
.
这篇关于警告:touch():Utime 失败:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!