11
toddherrold
Re: max_questions resource problem AND SOLUTION!!

Below is a post from a phpnuke forum. . apparently XOOPS and phpnuke both have problems with running large #s of dbase queries. Anyway, the suggestion below is to add $db_users. I've added these in MySQL.

Can someone more technically savvy than me, please post how we would implement a similar solution in XOOPS? It would be greatly appreciated by many of us!


Quote:
(host) currently limits users to 72,000 SELECT queries, per hour, per user. Once you have used up your quota, you will begin to receive "max_questions" errors until the end of the hour, and your quota is reset. Please note, this limit only applies to SELECT queries, and not INSERT queries. There has been no official word on whether UPDATE queries are affected.

Most users will never notice this limitation, however there are some programs out there that are very unconservative with their queries. Forums (AKA: bulletin boards, message boards) such as phpbb and CMS's (Content Management Systems) such as phpnuke are typically the greatest offenders due the large number of queries and the rapid click through rate.

To compensate for this limitation, you can set up 2 additional users (for a total of 3 users), and spread out your queries among them. This will give you a total of 216K SELECT queries. To set this up, you must complete 5 steps.

1) Log in to ops and go to packages > MySQL. Add users until you have 3, making sure that each user has the exact same password.

2) Locate where the database information is stored. Often it will be in a file called config.php, base.php, include.php or common.php. You should find the name, the user name, password, and server for your database.

3) Once you have found the file, you will see the variables defined in one of two fashions.
A regular variable will look like this: $db_user = "user_name";
Defined variables will look like this: define("db_user", "user_name");

4) Add the following lines of code immediately after the line you commented out.

$db_user_array[] = ""; //enter 1st user name
$db_user_array[] = ""; //enter 2nd user name
$db_user_array[] = ""; //enter 3rd user name

5) Depending on whether your script uses regular variables, or defined variables, enter one of the following lines after everything else we just added. Make sure you change "db_user" into whatever the correct name should be (see the line that you commented out).

//regular variable
$db_user = $db_user_array[ rand( 0, ( sizeof($db_user_array) -1 ) ) ];

//defined variable
define( "db_user", $db_user_array[ rand( 0, ( sizeof($db_user_array) -1 ) ) ] );

If you end up needing to remove one of your database user names in order to allow someone else to use your database, or if Powweb changes their number of users, updating the rotation script is as simple as adding or removing users from the list (eg: $db_user_array[] = ""

Login

Who's Online

111 user(s) are online (84 user(s) are browsing Support Forums)


Members: 0


Guests: 111


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits