PHP可以不写文档根目录以外的不管是什么 [英] PHP can't write outside of the document root no matter what

查看:201
本文介绍了PHP可以不写文档根目录以外的不管是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CentOS 5.7典型的httpd运行VM安装。

Running a VM with CentOS 5.7 with typical httpd install.

我试图写一个文件到文件夹的/ var / www / html等之外,让在的/ var / somedir <说/ code>

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


  • 我chmoded somedir 777

  • 我把它chowned到Apache:阿帕奇(根:apache没有工作,要么)

  • PHP的safe_mode设置为关闭

  • PHP的doc_root的是空的(即的doc_root =

  • 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 =)

我不能使用重命名()动的东西了文档根的,我不能用fwrite()将到外面它可以创建一个文件。

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.

只是为了验证,我exec'd WHOAMI 从一个php文件,并将其回显的/在浏览器中访问时返回的Apache。

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

我想我已经打了谷歌与这个约200 searchs到目前为止,我想我还是失去了一些东西。

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

推荐答案

原来对SELinux在启用其实,虽然我的Linux的家伙向我保证,这是不!

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

这篇关于PHP可以不写文档根目录以外的不管是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆