符号链接中的php文件处理不起作用

时间:2013-02-08 16:30:52

标签: php apache symlink file-handling

我在使用符号链接的apache2服务器上遇到了一些麻烦。

基本www文件夹位于“/ var / www // htdocs”中。 我做了一个符号链接表单/ home // log“to”/ var / www // htdocs / l /“并将其称为”log“。

在我的意见中,所有权利都是针对www-data用户和组的正确给出的。

在我的脚本中,我收到了这个错误:

Warning: fopen(): open_basedir restriction in effect.File(/var/www/<domain>/htdocs/l/log/logs_test.log) is not within the allowed path(s): (/var/www/<domain>:/usr/share/pear:/usr/share/php:/tmp:/usr/share/phpmyadmin) in /var/www/<domain>/htdocs/l/test.php on line 7 Warning: fopen(/var/www/<domain>/htdocs/l/log/logs_test.log): failed to open stream: Operation not permitted in /var/www/<domain>/htdocs/l/test.php on line 7

当我在apache2.conf中添加来自符号链接的实路径时,应该解决这个问题。但是,这是我的问题:我不会为每个符号链接添加实际路径。

我希望你能理解我的问题,如果你需要更多信息,请告诉我。

1 个答案:

答案 0 :(得分:0)

是的,问题在于PHP中的open_basedir安全限制。如果要打开指定目录树之外的文件,只需放宽限制即可。请阅读此处了解有关如何执行此操作的更多选项:

http://www.php.net/manual/en/ini.core.php#ini.open-basedir