I need help getting PHP (v5.4.45) errors and permissions working properly after a server was migrated. Some of my sites need to access some files from another domain on the same server.
For example, /var/www/vhosts/planetrockcm.com/httpdocs/test.php
might try to include /var/www/vhosts/rock.church/httpdocs/robots.txt
using PHP include "/var/www/vhosts/domain1/httpdocs/robots.txt";
In Plesk (v17.5.3) I went into the domain > PHP settings > and modified the open_basedir settings to include /var/www/vhosts/rock.church/httpdocs/
(pic)
I setup an example to show what I'm getting at http://planetrockcm.com/test.php
Here's what test.php has in it:
<?php
include "/var/www/vhosts/rock.church/httpdocs/robots.txt";
phpinfo();
?>
Here's the error's I'm getting: (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
It is saying there is an open_basedir restriction. The confusing part to me is that I actually added the path in manually as seen in the error itself.
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/)
Update:
I have followed this post from support.plesk.com to ensure open_basedir
is set to none
on all the domains. After running this I was no longer getting the open_basedir restriction
warning, only the failed to open stream: Permission denied
warning. (pic)
I also confirmed that SELinux is disabled. (pic)
Permissions for var/www/vhosts/rock.church/httpdocs/
755 drwxr-xr-x 10 rockchadmin 4.0K Feb 22 01:34 httpdocs/
(pic)
Permissions for var/www/vhosts/planetrockcm.com/httpdocs/test.php
755 -rw-r--r-- 1 pr_cm_admin 161 Mar 23 19:32 test.php
(pic)
I can see that they are owned by different users. I'm not sure if that's the problem.
I'm really grateful for any help getting this resolved or pointing me in the right direction. My host is saying they are not able to help.