CodeIgniter Forums

Full Version: Multiple Databases in database.php - Storing 1 DB's Credentials in External File
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

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";

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

$db['db2']['hostname'] = "localhost";

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

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?