1

I've looked at questions (and answers) about openbase_dir where the required or included file was outside the allowed path(s). I've looked at all the suggested similar questions while editing this one, but I didn't find a case like mine.

I'm using Plesk 12.5 on a CentOS VPS.

I have a maindomain.com with a subdomain.maindomain.com and also otherdomain1.com, otherdomain2.com, otherdomain3.com and so on.

I need to access some files located in /var/www/vhosts/maindomain.com/subdomain.maindomain.com from all otherdomains.com.

In my case I've included in both open_basedir

.:/opt/plesk/php/7.0/share/pear:/var/www/vhosts/maindomain.com/subdomain.maindomain.com

and include_path

{WEBSPACEROOT}{/}{:}{TMP}{/}:/var/www/vhosts/maindomain.com/subdomain.maindomain.com/

the exact path where I need to look into, but I still get the error:

Warning: require_once(): open_basedir restriction in effect.
File(/var/www/vhosts/maindomain.com/subdomain.maindomain.com/filename.php) is not within the allowed path(s): 
(/var/www/vhosts/otherdomain.com/:/tmp/:/var/www/vhosts/maindomain.com/subdomain.maindomain.com) 
in /var/www/vhosts/otherdomain.com/httpdocs/index.php on line XXX

Warning: require_once(/var/www/vhosts/maindomain.com/subdomain.maindomain.com/filename.php): failed to open stream: 
Operation not permitted in /var/www/vhosts/otherdomain.com/httpdocs/index.php on line XXX

Fatal error: require_once(): Failed opening required '/var/www/vhosts/maindomain.com/subdomain.maindomain.com/filename.php' 
(include_path='.:/opt/plesk/php/7.0/share/pear:/var/www/vhosts/maindomain.com/subdomain.maindomain.com') 
in /var/www/vhosts/otherdomain.com/httpdocs/index.php on line XXX

Summarizing...

I can't access /var/www/vhosts/maindomain.com/subdomain.maindomain.com/filename.php from /var/www/vhosts/otherdomain.com/httpdocs/index.php while this path /var/www/vhosts/maindomain.com/subdomain.maindomain.com is in both open_basedir and include_path.

What else am I missing?

Anyone had the same problem?

Thanks

  • maybe it's a behavior of the dot in `open_basedir` – Deadooshka May 27 '17 at 11:48
  • @Deadooshka thanks for commenting. Can you explain it to me please? – Alessandro Raffa May 27 '17 at 17:30
  • 1
    I always add a trailing slash to `open_basedir` directories, due to the [manual](http://php.net/manual/en/ini.core.php#ini.open-basedir). The dot means a current directory that changable with `chdir()` inside a script. – Deadooshka May 28 '17 at 03:15
  • I tried both with trailing slash and without. There is no dot in the path. I also tried configuring only open_basedir or only include_path, then both. Still not working. – Alessandro Raffa May 29 '17 at 13:11
  • What are permissions and ownership of the /var/www/vhosts/maindomain.com/subdomain.maindomain.com directory? – Mikhail Bunkin Jul 04 '17 at 05:20

0 Answers0