If you're having a "db user exceeded" problem, then your hosting account is slightly underpowered for your site. The best solution is to switch to a hosting company that doesn't impose unrealistically low restrictions on your account. (Some hosts will tell you that you need to "pay more" to get allowance for more queries ... but that's still marrying you to an underpowered solution, and lining the pockets of your hosting company instead of giving you better performance. Be wary of their upsell ploys.)
However, if you can't or won't change to a more solid hosting service, the following may help you:
1. Create 4 database-users for your database.
It's okay to use the same password for each if you wish.
Be sure to grant all 4 the same permissions to the same database.
2. Open your /includes/configure.php file and make this code change:
Around line 60 or so you have:```
// define our database connection
define('DB_TYPE', 'mysql');
define('DB_PREFIX', '');
define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty
define('DB_SERVER_USERNAME', 'my_db_username');
define('DB_SERVER_PASSWORD', 'my_db_password');
define('DB_DATABASE', 'zencart');
Replace the following 2 lines:```
define('DB_SERVER_USERNAME', 'my_db_username');
define('DB_SERVER_PASSWORD', 'my_db_password');
with the following, substituting your new database usernames and passwords in the $dbuser[]= and $db_pwd[]= lines:```
/********************************************************************************
- The following code block alternates database users based on 15-minute segments
- It supports separate users for each 15-minute segment of a given hour
*/
// Enter your 4 database usernames here.
// If you have only two, then repeat them: first, second, first, second
$dbuser[] = 'username1';
$db_pwd[] = 'password1';
$dbuser[] = 'username2';
$db_pwd[] = 'password1';
$dbuser[] = 'username3';
$db_pwd[] = 'password1';
$dbuser[] = 'username4';
$db_pwd[] = 'password1';
// NO NEED TO DO ANYTHING IN THIS SECTION:
// calculate the current "minute"
$current_minute = date('i');
// calculate which "quarter of the hour" we're in
$db_user_active = (int)($current_minute/15);
define('DB_SERVER_USERNAME', $dbuser[$db_user_active]);
define('DB_SERVER_PASSWORD', $db_pwd[$db_user_active]);
//echo $db_user_active;
/**
- END OF rotating db-users code
*******************************************************************************/
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.