including php file from another account - suEXEC

LiteSpeeder

Well-Known Member
#1
Hello,

I'm trying to include a PHP file from another account, same server.

domain1.com/abc.php includes the line below:

require('/var/www/vhosts/domain2.com/httpdocs/test/test.php');

but it fails due to PHP suEXEC is set to 'Yes':

...failed to open stream: Permission denied in...


What I am trying to achieve is to use a global PHP file which has some arrays and variables that will be used by multiple domains.

Incase an update is needed, I'll edit the test.php in domain2.com, and the changes will apply to multiple domains.

How can I do this without disabling suEXEC?

Thank you.
 

LiteSpeeder

Well-Known Member
#3
Yes, I know this method is similar to how malware, etc. works in an unsecure environment.

The server hosts 100+ domains, some parts of the sites are identical and I really need a method to include some PHP code for bulk/mass updating.

I guess I have to find alternative ways of doing this.
 

LiteSpeeder

Well-Known Member
#5
Thanks for the suggestion.

I tested like this:

In domain1.com's .htaccess:
Alias "/test321/" "/var/www/vhosts/domain2.com/test321/"
(tried both with or without the trailing slash)

In domain1.com/abc.php:
require('/test321/test.php');

Result:
PHP Warning: require(/test321/test.php): failed to open stream: No such file or directory in /var/www/vhosts/domain1.com/httpdocs/abc.php

It's a Plesk server. Am I on the right track?
 

LiteSpeeder

Well-Known Member
#7
Removed from .htaccess and moved to Plesk's Apache & nginx Settings:
1586521921185.png

Still "not found" error. I don't know where else I can easily add Alias for the vhosts.
 

NiteWave

Administrator
#8
just read through your posts again.
Alias is for apache/litespeed , not for php, can't be used in php script require/include:
require('/test321/test.php');
it's used in this way: domain1.com/test321/phpinfo.php
where phpinfo.php is under /var/www/vhosts/domain2.com/test321/
 

NiteWave

Administrator
#9
if you really want require('/test321/test.php'); to work, just create a symbol link
cd /var/www/vhosts/domain1.com/httpdocs
ln -s /var/www/vhosts/domain2.com/test321 tes321
 
Top