DOMDocument::save[domdocument.save]: failed to open stream: Permission denied

怎甘沉沦 提交于 2021-01-27 20:32:23

问题


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.

I always got this error:

Warning: DOMDocument::save(/home/admin/xxxxxx) [domdocument.save]: failed to open stream: Permission denied in /home/admin/xxxxx on line 240

What can I do now? I have chmod 777 the directory and still not working...


回答1:


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 .

If this works, try to narrow down the rw rights by removing the write bit for everyone:

chmod a-w .

And only granting it to the default web server group (see your GNU/Linux distribution manual) eg:

chown .www-data .


来源:https://stackoverflow.com/questions/13108661/domdocumentsavedomdocument-save-failed-to-open-stream-permission-denied

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!