问题描述
我有一个代码可以将一个 XML 文件保存到我的目录中.它实际上就像我的本地主机中的魅力一样在我的共享主机中,但它在我的 Linux VPS 中不起作用.
I have a code which would save an XML file to my directory. It is actually works like a charm in my localhost & in my shared host BUT its not working in my Linux VPS.
我总是收到这个错误:
警告:DOMDocument::save(/home/admin/xxxxxx) [domdocument.save]:无法打开流:在第 240 行的/home/admin/xxxxx 中的权限被拒绝
Warning: DOMDocument::save(/home/admin/xxxxxx) [domdocument.save]: failed to open stream: Permission denied in /home/admin/xxxxx on line 240
我现在能做什么?我有 chmod 777 目录,但仍然无法正常工作...
What can I do now? I have chmod 777 the directory and still not working...
推荐答案
您可能无权在此文件夹中写入内容,即使文件是可读/可写的.试试
You probably don't have the right to write something in this folder, even if the file is read/writable. Try
cd /said/folder
chmod a+w .
如果可行,请尝试通过删除每个人的写入位来缩小 rw 权限:
If this works, try to narrow down the rw rights by removing the write bit for everyone:
chmod a-w .
并且仅将其授予默认 Web 服务器组(请参阅您的 GNU/Linux 分发手册)例如:
And only granting it to the default web server group (see your GNU/Linux distribution manual) eg:
chown .www-data .
这篇关于DOMDocument::save[domdocument.save]:无法打开流:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!