ATVTorture
11-13-2008, 03:43 PM
We're randomly getting max_user_connection errors b/c our host has an insanely low number set for simultaneous connections and won't increase. Our board really doesn't get much traffic so we should be hitting limits. Beside the point, I need a work-around.
I can have multiple users for a DB so i want to modify the config.php file to include an array of 3 DB users to flip between. however, something is botched in my code and when I load this in the config file, the site just shows as a white page. Can someone look at it and tell me how to fix it?
Thanks!
I replaced this:
$config['MasterServer']['username'] = 'USERNAME';
$config['MasterServer']['password'] = 'PASSWORD';
With this:
// Random mysql users code (three mysql users example):
$dbusers = array(
array(’user’ => ‘USERNAME1′, ‘password’ => ‘PASSWORD1′) // First MySQL user/password combination
, array(’user’ => ‘USERNAME2′, ‘password’ => ‘PASSWORD2′) // Second MySQL user/password combination
, array(’user’ => ‘USERNAME3′, ‘password’ => ‘PASSWORD3′) // Third MySQL user/password combination
);
$mysql_user = $dbusers[rand(0, count($dbusers) - 1)];
$config['MasterServer']['username'] = $mysql_user['user'];
$config['MasterServer']['password'] = $mysql_user['password'];
I can have multiple users for a DB so i want to modify the config.php file to include an array of 3 DB users to flip between. however, something is botched in my code and when I load this in the config file, the site just shows as a white page. Can someone look at it and tell me how to fix it?
Thanks!
I replaced this:
$config['MasterServer']['username'] = 'USERNAME';
$config['MasterServer']['password'] = 'PASSWORD';
With this:
// Random mysql users code (three mysql users example):
$dbusers = array(
array(’user’ => ‘USERNAME1′, ‘password’ => ‘PASSWORD1′) // First MySQL user/password combination
, array(’user’ => ‘USERNAME2′, ‘password’ => ‘PASSWORD2′) // Second MySQL user/password combination
, array(’user’ => ‘USERNAME3′, ‘password’ => ‘PASSWORD3′) // Third MySQL user/password combination
);
$mysql_user = $dbusers[rand(0, count($dbusers) - 1)];
$config['MasterServer']['username'] = $mysql_user['user'];
$config['MasterServer']['password'] = $mysql_user['password'];