问题
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