PHP can't write outside of the document root no matter what

折月煮酒 提交于 2019-12-11 07:56:14

问题


Running a VM with CentOS 5.7 with typical httpd install.

I'm trying to write a file to a folder outside of /var/www/html, lets say in /var/somedir

  • I've chmoded somedir with 777
  • I chowned it to apache:apache (root:apache didn't work either)
  • PHP's safe_mode is off
  • PHP's doc_root is empty (i.e. doc_root =)

I can't use rename() to move something out of the doc root and I can't use fwrite() to create a file outside of it either.

Just to verify, I exec'd whoami from a php file and it echo'd/returned apache when accessed in the browser.

I think I've hit google with about 200 searchs about this so far and I guess I'm still missing something.


回答1:


Turns out that selinux was in fact enabled although my "linux guy" assured me that it was not!



来源:https://stackoverflow.com/questions/9056628/php-cant-write-outside-of-the-document-root-no-matter-what

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