• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

How include php-files from another domain

D

DadRover

Guest
I have Client and at the client some domains (more than ~100). How, from one domain include php-files from another domain with php-commands "require ()" which statement includes and evaluates the specific file?
ex:

body of file "somefile.php" from first domen (domen1.com)
<?php echo "Hello"; ?>

"index.php" file second domen (domen2.com)
<?php require ('../../domen.com/http/somefile.php');?>

Expected result domen2.com:
Hello
 
Hi
Most probably you should enable the access to the PHP scripts of another virtual host by configuring open_basedir directive where the new path value is redefined. To get it work with Plesk you will need to create a separate vhost.conf file in the $HTTPD_VHOSTS_D/domain.tld/conf/ directory. The directive should be like:
<Directory HTTPD_VHOSTS_D/domain.com/httpdocs>
php_admin_value open_basedir "HTTPD_VHOSTS_D/domain.com/httpdocs:/tmp:/"HTTPD_VHOSTS_D/domain2.com/httpdocs
</Directory>
After that you should run
/usr/local/psa/admin/sbin/websrvmng -v -a
to apply the changes. After that the script should be accessible, try.
 
Back
Top