0

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

例如,/var/www/vhosts/planetrockcm.com/httpdocs/test.php可能会尝试包含/var/www/vhosts/rock.church/httpdocs/robots.txt使用 PHPinclude "/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();

?>

这是我得到的错误:(图片

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 的这篇文章,以确保在所有域上都open_basedir设置为。none运行此之后,我不再收到open_basedir restriction警告,只有failed to open stream: Permission denied警告。(图片

我还确认 SELinux 已禁用。(图片

var/www/vhosts/rock.church/httpdocs/755的权限drwxr-xr-x 10 rockchadmin 4.0K Feb 22 01:34 httpdocs/图片

var/www/vhosts/planetrockcm.com/httpdocs/test.php755的权限-rw-r--r-- 1 pr_cm_admin 161 Mar 23 19:32 test.php图片

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

我非常感谢任何帮助解决这个问题或为我指明正确的方向。我的主人说他们无法提供帮助。

4

0 回答 0