How connect to database in another site of same server

Started by pere, April 18, 2022, 06:33:40 PM

Previous topic - Next topic

pere

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 include("./home/A/public_html/settings/settings.inc"); but no success. In settings I have ########## 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.

rcschaff

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