有什么办法可以绕过php open_basedir的符号链接吗?

时间:2016-09-25 09:17:09

标签: php apache open-basedir

我已经在Linux中的Apache虚拟主机中配置了open_basedir,它工作正常。

<Directory /var/www/abc/public_html>
     php_admin_value open_basedir "/var/www/abc/public_html"
</Directory>

我需要允许一个位于指定basedir(/var/www/abc/public_html/files --> ../files)之外的符号链接。

有没有这样做?

1 个答案:

答案 0 :(得分:2)

没有办法绕过open_basedir限制,没有。但是,您可以只包含open_basedir的附加符号链接路径,因为它可以接受的不仅仅是一条路径。

open_basedir=/var/www/abc/public_html:/var/www/abc/files

  

所有符号链接都已解析,因此无法通过符号链接来避免此限制。

     

PHP Manual: open_basedir

您必须记住的是open_basedir允许给定路径中的所有内容。这意味着一旦访问被授予路径/var/www/abc/files,该路径中的所有内容(如/var/www/abc/files/foo/var/www/abc/files/bar等)也是允许的。