Control Web Panel

WebPanel => MySQL => Topic started by: pere on April 18, 2022, 06:33:40 PM

Title: How connect to database in another site of same server
Post by: pere on April 18, 2022, 06:33:40 PM
In my server, I have one site A with a database. Now I have a 2nd site B that needs to connect to database in A. From B I've tried to get the connection parameters with
Code: [Select]
include("./home/A/public_html/settings/settings.inc"); but no success. In settings I have
Code: [Select]
########## Database Info ##########
define('DB_SERVER', 'localhost');
define('DB_USER', 'myUser');
define('DB_PASS', 'myPass');
define('DB_NAME', 'ThedbName');
define('DB_CHARSET', 'UTF8');
I'll appreciate your help.
Title: Re: How connect to database in another site of same server
Post by: rcschaff on April 19, 2022, 03:47:30 AM
You cannot access /home/A from /home/B by default for security purposes.  You have a few options.

1)  Copy the settings.inc from /home/A to /home/B and chown the files to B
2) You can use "setfacl" to give B permission to A's files
3)  You can make B part of A's group in linux  "usermod -G A"
Title: Re: How connect to database in another site of same server
Post by: pere on April 19, 2022, 04:13:48 PM
Thank you!