PHP的文件权限问题
我正在尝试创建一个文件夹并在该文件夹内fopen
一个文件。
mkdir
可以很好地创建文件夹(因为父文件夹具有 777 权限),但生成的文件夹由用户 id 99 拥有,而脚本本身在用户 id 32024 的 cpanel 下运行。现在当我尝试在该文件夹中创建一个文件,我得到:
安全模式限制生效。 uid为32024的脚本不允许访问/
/ 由 uid 99 拥有
此错误是完全合理的,因为我试图写入其他人拥有的文件夹,但在 32024 下运行的脚本如何创建所有者为 99 的文件夹?服务器的行为方式有什么问题吗?有什么想法吗?
I am trying to create a folder and fopen
a file inside that folder.
mkdir
works fine for creating the folder (as the parent folder has 777 permission), but the resulting folder is owned by user id 99 while the script itself is running under cpanel with user id 32024. Now when I try to create a file inside this folder, I get:
SAFE MODE Restriction in effect. The script whose uid is 32024 is not allowed to access /<path_of_file>/<folder_created_by_php> owned by uid 99
This error is fully justifiable as I am trying to write to a folder owned by someone else but how can a script running under 32024 create a folder with owner as 99? Anything wrong with the way server is behaving? Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的问题与 php 上的安全模式设置有关:
查看此以获取更多信息:http://www.serverschool.com/dedicated-servers/what-is-php-safe-mode/ 您将拥有所有信息来了解什么是安全模式实际上......
只需要求您的开发人员不要按原样使用 safe_mode如今所有服务器上都不推荐的功能......
Your problem is related to the safe mode setting on php:
Check this out for more information: http://www.serverschool.com/dedicated-servers/what-is-php-safe-mode/ You'll have all the information to understand what is safe mode actually...
Just ask for your developers NOT to use safe_mode as it is a features unrecommended on all servers these days...
您可以尝试将用户 99 和 32024 包含到同一组中,并在创建该文件后 chmod('yourfilename', 0775)
You can try to include both users 99 and 32024 to the same group and chmod('yourfilename', 0775) after you create that file