php fopen 没有权限,php – fopen()无法打开流:权限被拒绝,但权限应该是有效的
所以,我有这个错误:Warning: fopen(/path/to/test-in.txt) [function.fopen]: failed to open stream: Permission denied在test-in.txt所在的目录中执行ls -l会产生以下输出:-rw-r--r-- 1 $USER $USER 1921 Sep6 20:09 test-in.txt-rw-r--r..
所以,我有这个错误:
Warning: fopen(/path/to/test-in.txt) [function.fopen]: failed to open stream: Permission denied
在test-in.txt所在的目录中执行ls -l会产生以下输出:
-rw-r--r-- 1 $USER $USER 1921 Sep 6 20:09 test-in.txt
-rw-r--r-- 1 $USER $USER 0 Sep 6 20:08 test-out.txt
为了解决这个问题,我决定执行以下操作:
chgrp -R www-data /path/to/php/webroot
然后做了:
chmod g rw / path / to / php / webroot
但是,当我运行php5脚本打开文件时,我仍然会收到此错误.为什么会这样?我用LAMP和切诺基通过CGI试过这个,所以不能这样.
有某种解决方案吗?
编辑
我还要补充一点,我现在正在通过localhost进行开发.
更新 – PHP fopen()行
$fullpath = $this->fileRoot . $this->fileInData['fileName'];
$file_ptr = fopen( $fullpath, 'r+' );
我还要提一下,如果可能,我想坚持使用切诺基.关于为Apache / Cherokee设置文件权限的问题是什么?
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)