PHP opend_basedir限制问题

时间:2018-03-23 22:43:14

标签: php plesk open-basedir plesk-onyx

我需要帮助在迁移服务器后使PHP (v5.4.45)错误和权限正常工作。我的一些站点需要从同一服务器上的另一个域访问某些文件。

例如,/var/www/vhosts/planetrockcm.com/httpdocs/test.php可能会尝试使用PHP /var/www/vhosts/rock.church/httpdocs/robots.txt

来包含include "/var/www/vhosts/domain1/httpdocs/robots.txt";

在Plesk (v17.5.3)我进入了域> PHP设置>并修改了open_basedir设置以包含/var/www/vhosts/rock.church/httpdocs/pic

我设置了一个示例来展示我在http://planetrockcm.com/test.php

获得的内容

这是test.php中的内容:

<?php

  include "/var/www/vhosts/rock.church/httpdocs/robots.txt";

  phpinfo();

?>

以下是我得到的错误:(pic

Warning: include(): open_basedir restriction in effect. File(/var/www/vhosts/rock.church/httpdocs/robots.txt) is not within the allowed path(s): (/var/www/vhosts/planetrockcm.com/:/tmp/:/var/www/vhosts/rock.church/httpdocs/) in /var/www/vhosts/planetrockcm.com/httpdocs/test.php on line 3

Warning: include(/var/www/vhosts/rock.church/httpdocs/robots.txt): failed to open stream: Operation not permitted in /var/www/vhosts/planetrockcm.com/httpdocs/test.php on line 3

据说有一个open_basedir限制。对我来说令人困惑的部分是我实际上手动添加了路径,如错误本身所示。

  

open_basedir限制生效。文件( /var/www/vhosts/rock.church/httpdocs / ** robots.txt)不在**允许的路径中 :( / var / www / vhosts / planetrockcm。 COM /:/ TMP /:的 /var/www/vhosts/rock.church/httpdocs /

更新 我已关注support.plesk.com上的this post,以确保open_basedir在所有域中设置为none。运行此操作后,我不再收到open_basedir restriction警告,只收到failed to open stream: Permission denied警告。 (pic

我还确认SELinux已被禁用。 (pic

var/www/vhosts/rock.church/httpdocs/ 755 drwxr-xr-x 10 rockchadmin 4.0K Feb 22 01:34 httpdocs/pic

的权限

var/www/vhosts/planetrockcm.com/httpdocs/test.php 755 -rw-r--r-- 1 pr_cm_admin 161 Mar 23 19:32 test.phppic

的权限

我可以看到它们归不同用户所有。我不确定这是不是问题所在。

我真的很感激任何帮助解决这个问题或者指出我正确的方向。我的主人说他们无法提供帮助。

0 个答案:

没有答案