Author Topic: How connect to database in another site of same server  (Read 5225 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How connect to database in another site of same server
« 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.

Offline
****
Re: How connect to database in another site of same server
« Reply #1 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"
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: How connect to database in another site of same server
« Reply #2 on: April 19, 2022, 04:13:48 PM »
Thank you!