Welcome Guest, Not a member yet? Register   Sign In
Multiple Databases in database.php - Storing 1 DB's Credentials in External File
#1

[eluser]Unknown[/eluser]
In my application/config/database.php file, I have successfully been using it with two databases, like as follows (truncated):

$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = "localhost";
AND SO ON...

$active_group = "db2";
$active_record = TRUE;

$db['db2']['hostname'] = "localhost";
AND SO ON...

For various reasons I want to store the database credentials for the 2nd database in an external file on another domain e.g. otherdomain.com/credentialsfordb2.php

But whatever I try, it always returns this error:

You have specified an invalid database connection group.

I have tried "normal" CURL, the cURL library for CodeIgniter, standard PHP include, require_once and all that other stuff, and nothing works.

But if I simply revert database.php back to including both database's credentials, it works fine! Thing is, one of the databases is more sensitive, hence me wanting to store it's credentials separately.

Any ideas?




Theme © iAndrew 2016 - Forum software by © MyBB