• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

PHP permissions on different vhosts

dtbaker

Basic Pleskian
Hey all.. been pulling my hair out on this:

Scenerio:

have two domains on one server:
/home/httpd/vhosts/domain1.com/httpdocs
/home/httpd/vhosts/domain2.com/httpdocs

domain1.com runs a php script which needs access to other domains 'httpdocs' directories.

eg: /home/httpd/vhosts/domain1.com/httpdocs/edit_me.php

PHP:
<?php

$domain_name = "foo.com";
$site_root = "../../../$domain_name/httpdocs";

if(( $fd = fopen( "$site_root/welcome/site_pages.inc", "r" )) == NULL ){
  echo "Could not open: $site_root/welcome/site_pages.inc";
  exit;
}

etc...
?>


here's where i have a brain fart:

if i copy /home/httpd/vhosts/domain1.com/httpdocs/edit_me.php over to /home/httpd/vhosts/domain2.com/httpdocs/edit_me.php

http://domain1.com/edit_me.php works fine... but running
http://domain2.com/edit_me.php doesn't..

I do not get a fopen error from php or from the echo "Could not open: $site_root/welcome/site_pages.inc"; part.. the script just.. stops ?

I have changed file permissions under both domains and the accounts have full read access onto those files...

I'm left with wondering if there is a chroot environment setup for domain2 and not for domain1...

this is where I need ur help... how do i check if a domain hosted on this plesk server is running in a chroot..?

and how do i disable a chroot?

thanks heaps..

Dave.
 
You don't write what error message your'e getting - would help a lot!

But I guess your problem should be found in your open_basedir settings?

Your PHP for domain2 should be restricted into only includeing files from within it's own path. As should by the way also the php runned from domain1.
 
Sorry for not making it clearer:

> I do not get a fopen error from php or from the echo "Could not open: $site_root/welcome/site_pages.inc"; part.. the script just.. stops ?

Yes there were 'no' error messages, even after telling /etc/php.ini to display everything,

The script just stopped executing when it tried to open the file.

open_basedir is not currently set to anything in /etc/php.ini

i cant find any site or vhost specefic php configuration files.... any idea where they reside?

cheers heaps
dave
 
Found it:

/home/httpd/vhosts/domain1.com/conf/httpd.include

has:

#php_admin_value open_basedir "/home/httpd/vhosts/domain1.com/httpdocs:/tmp"

but in domain2.com's httpd.include this option is not commented out.

thx
dave.
 
Dosen't matter what the open_basedir setting in your php.ini says - what is specified in your httpd.conf setting?

Put:

Code:
<?php phpinfo(); ?>

in a .php file in domain2 and see what the open_basedir setting is (local value)...
 
Back
Top