• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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