4images Forum & Community
4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: kief24 on May 22, 2005, 10:35:56 PM
-
Hello,
i get the error message on my site :
DB Error: Bad SQL Query: SELECT setting_name, setting_value FROM 4images_settings
User 'edupicsc_test' has exceeded the 'max_questions' resource (current value: 70000)
my host tells me this is because there are connections that stay open, and that should be something "wrong" in the code.
are you familiar with this problem ? and is there something to fix it ?
thx !!!
-
Personally I've never heard of it.
-
this is what the technical staff mails me :
Prsently we have set max limit(no of requests) on our server as 70000 per account. This is prevention measure against server crash or any other damage to server. We have set this limit for better operation and if you are getting these errors again and again, you need to check your scripts(pages) are not using more no of the server resoucres, if so you should modify them so that they will nor exceed allowed server resoureces.
-
Maybe it's from a mod you installed? In 3 years, I've never heard of this problem before.
-
i just can't get it.
I have a "twin" site running in Dutch, with the same hosting company, and no problems on that site...
However...
on other forums they seem to know the problem also, and they suggest there that you make more than 1 user for your database, and if the limit is reached ( 70 000 ), you automaticly swith to the next user and that user can also take 70 000 connections.
The idea makes sense, but the code... i'm no good in that.
This is what was posted at the other forum, maybe someone can tell me if this can be used in 4images...
<?php
// Database configuration
$db_server = "";
$db_name = "";
// User configuration
$db_username = "user_1";
$db_password = "pass_1";
if ( !mysql_connect($db_server, $db_username, $db_password) ) {
$db_username = "user_2";
$db_password = "pass_2";
} elseif ( !mysql_connect($db_server, $db_username, $db_password) ) {
$db_username = "user_3";
$db_password = "pass_3";
} elseif ( !mysql_connect($db_server, $db_username, $db_password) ) {
die("Database Connection Error!");
}
// Other Settings
$filename = ""; // Specify the dump filename to suppress the file selection dialog
$linespersession = 3000; // Lines to be executed per one import session
$delaypersession = 0; // You can specify a sleep time in milliseconds after each session
// Works only if JavaScript is activated. Use to reduce server overrun
?>
-
interesting information here :
http://forum.powweb.com/showthread.php?s=&threadid=23735
( not my host - powweb )
-
i folowed the instructions mentioned in the link just above,
and now my config.php looks like this :
<?php
$db_servertype = "mysql";
$db_host = "localhost";
$db_name = "edu_4homepages";
#$db_user = "xxxx4";
$db_user_array[] = "xxxx4"; //enter 1st user name
$db_user_array[] = "xxxx5"; //enter 2nd user name
$db_user_array[] = "xxxx6"; //enter 3rd user name
//regular variable
$db_user = $db_user_array[ rand( 0, ( sizeof($db_user_array) -1 ) ) ];
$db_password = "xxxxx";
$table_prefix = "4images_";
define("4IMAGES_ACTIVE", 1);
?>
off course the xxxx is covering up.
the site still works fine, lets see now if the problem is gone
-
hmmm...intersting...normaly if a server has such limit, they provide only one database user anyway....am I wrong?
-
i could make 3 users for 1 database without any problem.
I just tried to make a 4th for the same database, and it could be done also.... i don't know what the limit is.
Do you think the new code in my config.php could solve this problem ?
-
with your method it could work, but it could require refresh a page every time the randomly selected user was rejected by the server.
Here is an alternative way which will try every user from an array untill one succeed:
in config.php use this array:$db_user = array(
"username1" => "pass1",
"username2" => "pass2",
"username3" => "pass3"
);
(the $db_user variable will contein both usernames and their passwords, so u can leave $db_password variable empty DO NOT REMOVE IT though)
then in includes/db_mysql.php replace if (!$this->connection = $connect_handle($db_host, $db_user, $db_password)) {
with this: foreach ($db_user as $user => $pass)
{
if ($this->connection = $connect_handle($db_host, $user, $pass)) break;
}
if (!$this->connection) {
-
thx a lot V@no !!!