Welcome Guest, Not a member yet? Register   Sign In
Configure CodeIgniter to run on two servers
#7

[eluser]Phil Sturgeon[/eluser]
Here's my views on this one "How to Support multiple production environments in CodeIgniter".

Using that approach cleans up your config files from storing domains in multiple locations and allows you to have a database file such as:

Code:
// Local
$db['local']['hostname'] = "localhost";
$db['local']['username'] = "root";
$db['local']['password'] = "";
$db['local']['database'] = "";
$db['local']['dbdriver'] = "mysql";
$db['local']['dbprefix'] = "";
$db['local']['active_r'] = TRUE;
$db['local']['pconnect'] = TRUE;
$db['local']['db_debug'] = TRUE;
$db['local']['cache_on'] = FALSE;
$db['local']['cachedir'] = "";
$db['local']['char_set'] = "utf8";
$db['local']['dbcollat'] = "utf8_unicode_ci";

// Dev
//$db['dev']['hostname'] = "localhost";
// ...etc

// QA
//$db['qa']['hostname'] = "localhost";
// ...etc

// Live
$db['live']['hostname'] = "localhost";
$db['live']['username'] = "root";
$db['live']['password'] = "";
$db['live']['database'] = "";
$db['live']['dbdriver'] = "mysql";
$db['live']['dbprefix'] = "";
$db['live']['active_r'] = TRUE;
$db['live']['pconnect'] = TRUE;
$db['live']['db_debug'] = TRUE;
$db['live']['cache_on'] = FALSE;
$db['live']['cachedir'] = "";
$db['live']['char_set'] = "utf8";
$db['live']['dbcollat'] = "utf8_unicode_ci";

// Check the configuration group in use exists
if(!array_key_exists(ENV, $db))
{
  show_error(sprintf(lang('error_invalid_db_group'), ENV));
}

// Assign the group to be used
$active_group = ENV;

?>


Messages In This Thread
Configure CodeIgniter to run on two servers - by El Forum - 06-03-2009, 06:58 AM
Configure CodeIgniter to run on two servers - by El Forum - 06-04-2009, 02:32 PM
Configure CodeIgniter to run on two servers - by El Forum - 06-04-2009, 11:31 PM
Configure CodeIgniter to run on two servers - by El Forum - 06-05-2009, 01:16 AM
Configure CodeIgniter to run on two servers - by El Forum - 06-05-2009, 01:39 AM
Configure CodeIgniter to run on two servers - by El Forum - 06-05-2009, 01:51 AM
Configure CodeIgniter to run on two servers - by El Forum - 06-05-2009, 05:51 AM
Configure CodeIgniter to run on two servers - by El Forum - 07-01-2009, 12:05 PM
Configure CodeIgniter to run on two servers - by El Forum - 07-01-2009, 12:46 PM
Configure CodeIgniter to run on two servers - by El Forum - 07-01-2009, 12:58 PM
Configure CodeIgniter to run on two servers - by El Forum - 07-01-2009, 01:27 PM
Configure CodeIgniter to run on two servers - by El Forum - 07-01-2009, 02:19 PM
Configure CodeIgniter to run on two servers - by El Forum - 07-25-2009, 07:03 PM
Configure CodeIgniter to run on two servers - by El Forum - 07-26-2009, 06:44 AM
Configure CodeIgniter to run on two servers - by El Forum - 07-26-2009, 11:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB