• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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