Author |
Message |
Donovan
Client

Joined: Oct 07, 2003
Posts: 735
Location: Ohio
|
Posted:
Wed Nov 03, 2004 9:03 am |
|
I need a no "bleep" assessment on whether this is a viable solution to my overactive forum. I get this error whenever I get around 30 on the board at one time. My host has their limit set to 50,000 and they said "change your code to be more efficient". Here is the fix for this but I need to know is this doable, and where should I make this change with PHPNuke. I wont advertise where I found this. It was just another Host provider.
--------------------------------------------------------------------------------
XXXXX 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[] = "" |
|
|
 |
 |
sixonetonoffun
Spouse Contemplates Divorce

Joined: Jan 02, 2003
Posts: 2496
|
Posted:
Wed Nov 03, 2004 9:14 am |
|
Should work just add the above edits to config.php above $dbuname = ""; and then set $dbuname = "$db_user";
So config.php looks like this:
$dbhost = "localhost";
$db_user_array[] = ""; //enter 1st user name
$db_user_array[] = ""; //enter 2nd user name
$db_user_array[] = ""; //enter 3rd user name
$db_user = $db_user_array[ rand( 0, ( sizeof($db_user_array) -1 ) ) ];
$dbuname = "$db_user";
This assumes all users have the same password and permissions on the same database. But thats the only limitation I see with it. |
_________________ [b][size=5]openSUSE 11.4-x86 | Linux 2.6.37.1-1.2desktop i686 | KDE: 4.6.41>=4.7 | XFCE 4.8 | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
| GeForce 6200@433Mhz 512MB | Xorg 1.9.3 | NVIDIA 270.30[/size:2b8 |
|
|
 |
Donovan

|
Posted:
Wed Nov 03, 2004 10:51 am |
|
How can I add 2 additional users to my database or account? I don't see anywhere in vDeck to do this. Would I have to call my host? |
|
|
|
 |
sixonetonoffun

|
Posted:
Wed Nov 03, 2004 10:57 am |
|
I've never used it but unless your account is limited to one user you "Should" be able to create a new user someplace in there where the database management is and grant the user parmissions on the database you have already. I know some hosts especially free ones like lycos will limit you to one database user and one database.
I don't know that the host will be too fond of someone cheating the limits they have configured and the whole idea may be considered a violation of their user agreement resulting in suspension or termination of the account! |
|
|
|
 |
Donovan

|
Posted:
Wed Nov 03, 2004 10:52 pm |
|
BOOOM
Warning: head(themes//theme.php): failed to open stream: No such file or directory in /home/i3rd-inf/public_html/header.php on line 31
Warning: head(): Failed opening 'themes//theme.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/i3rd-inf/public_html/header.php on line 31
Fatal error: Call to undefined function: themeheader() in /home/i3rd-inf/public_html/header.php on line 47 |
|
|
|
 |
sixonetonoffun

|
Posted:
Thu Nov 04, 2004 9:39 pm |
|
WTF? I actually did test that code on my localhost test site and it worked as expected. I left on as a not real username as a sorta double test to see how it reacted and it worked fine the message about Problems with mysql connection came up as expected. |
|
|
|
 |
sixonetonoffun

|
Posted:
Wed Dec 22, 2004 4:24 pm |
|
This code is good I don't know why it didn't work for Donovan but I'm running 4 users (with the same password) on my live site with it and it works fine. |
|
|
|
 |
Dacubz
Worker


Joined: Apr 27, 2004
Posts: 156
Location: Homer Glen, Illinois
|
Posted:
Sun Nov 20, 2005 10:43 am |
|
I had this problem and et up my config file this way, my site appears to be running faster for some reason too!
If your site crashed due to this error:
Code:
DB function failed with error number 1226
User 'your_user_name_here' has exceeded the 'max_questions' resource (current value: 50000) SQL=SELECT session_id FROM mos_session WHERE session_id=MD5('1aa637c8e7d13c9be419d455cd6db64c')
SQL =
SELECT session_id FROM mos_session WHERE session_id=MD5('1aa637c8e7d13c9be419d455cd6db64c')and you are currently hosted on a shared environment (i.e., you are not allowed to edit configuration files for PHP and MySQL or your host provider doesn't want to increase the max_questions value), here is a quick fix:
Go to your account's control panel (e.g., CPanel, DirectAdmin, vDeck, etc.). Access the MySQL feature and create 2-5 database users with the same password as your db user for Mambo/Joomla. Assign them to the database where your Mambo/Joomla site is.
Example:
DB name for Mambo/Joomla - myjoomla_cms
DB user for Mambo/Joomla - myjoomla_user
Create additional users for the database:
2nd DB user for Mambo/Joomla - myjoomla_user1
3rd DB user for Mambo/Joomla - myjoomla_user2
Don't forget to give them the same database privileges as your first Joomla DB user.
Then download your configuration.php from the server and open it in any HTML/PHP editor to modify it.
Look for this line:
Code:
$mosConfig_user = 'myjoomla_user';
Comment out the line above and add these lines below it:
Code:
$mosConfig_users = array("myjoomla_user", "myjoomla_user1", "myjoomla_user2");
$mosConfig_user = $mosConfig_users[array_rand($mosConfig_users)];
Explanation: The first line defines the users that can access your database. The second line randomly selects a user from the list on the first line.
Save the changes and re-upload the file to your server. |
|
|
|
 |
fkelly
Former Moderator in Good Standing

Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY
|
Posted:
Thu Feb 16, 2006 3:17 pm |
|
Just to add to this. First, the symptoms of this problem can be subtle. In my case it manifested itself when I could not login and when I clicked on the login box I got a message that the module your_account wasn't active. When I tried to go to the administration screen I got a message that there were no admins created yet. I could go into phpmyadmin and look at the authors table and see the admins but since the database interface was essentially "timed out" Nuke couldn't connect. Also I saw the missing default themes error listed above ... and that's because nuke tries to get the default theme from the nuke_config table and since it couldn't connect ...
Called my host (Ipowerweb) they said I just had to wait an hour. Had dinner and came back and the problem persisted. Called Ipowerweb again and was put on hold. Go into Host Manager, then databases, then setup and look at the users. Pick the user that you list in config.php and update it leaving the settings the same and the problem goes away (at least temporarily). I don't know if it ever would have cleared if I hadn't done that. Hang up on Ipowerweb ... like they care.
The "create three users" idea also looks like it will work and I'll probably try it some time too. Or just change hosts. Oh I went in and validated my robots.txt and fixed some problems to keep a bunch of useless robots out too. |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Thu Feb 16, 2006 5:06 pm |
|
Come on over to Raven Web Sevices, LLC. I do not limit your MySQL at all  |
|
|
|
 |
fkelly

|
Posted:
Thu Feb 16, 2006 6:39 pm |
|
I (and my web site) will probably be there sooner or later. I just need to make sure when my contract with Ipower expires and set aside enough time to deal with the inevitable issues ... dns changes etc. |
|
|
|
 |
Soulshade
New Member


Joined: Jan 06, 2006
Posts: 9
|
Posted:
Thu Mar 01, 2007 1:17 pm |
|
Awesome fix! My site load times decreased dramatically with this also. |
|
|
|
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Fri Mar 02, 2007 6:31 am |
|
Soulshade wrote: | My site load times decreased dramatically with this also. |
That is odd. I am struggling to think of why that would be the case. Makes no sense to me as these are dedicated connections. But, I guess if you are seing it... |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
fkelly

|
Posted:
Fri Mar 02, 2007 10:48 am |
|
Perception is everything M. I had the same reaction you did when I read about site load times being decreased. All the "fix" does is distribute the same workload over 3 users instead of one to fool Ipowerweb. For whatever comes after RN2.10 we are going to dramatically reduce the number of queries and that's going to reduce site load times, but that's another issue entirely. |
|
|
|
 |
Raven

|
Posted:
Fri Mar 02, 2007 11:01 am |
|
fkelly wrote: | Perception is everything M. I had the same reaction you did when I read about site load times being decreased. All the "fix" does is distribute the same workload over 3 users instead of one to fool Ipowerweb. For whatever comes after RN2.10 we are going to dramatically reduce the number of queries and that's going to reduce site load times, but that's another issue entirely. |
FK, I'd love to squeeze that one into v2.10.00 ! But, we won't. For the next release (after 2.10) I am planning to implement a whole new installation routine and I hope to put things like this in there, as a choice. |
|
|
|
 |
Soulshade

|
Posted:
Fri Mar 02, 2007 3:13 pm |
|
If it was just me seeing it I would be more compelled to believe the perception angle. Everyone using my site has noticed the decrease in load times also. |
|
|
|
 |
fkelly

|
Posted:
Fri Mar 02, 2007 11:22 pm |
|
That's odd but who knows? I know nothing about MYSQL internals but maybe it queues up queries for a single user so the the second one doesn't get processed until the first one is done (milliseconds but still it can add up). So maybe adding additional users adds some degree of parallelism and speeds things up. But that's pure speculation. I'm just glad it resolved your problem. |
|
|
|
 |
Raven

|
Posted:
Sat Mar 03, 2007 1:21 am |
|
There is nothing in multiple users that would cause a speed up, especially to other users. I'd just stick with the perception theory  |
|
|
|
 |
montego

|
Posted:
Sat Mar 03, 2007 3:21 pm |
|
Yeah, without really knowing the internals of mySQL, who knows, but I know from an Oracle standpoint, NO different! |
|
|
|
 |
viper155
Regular


Joined: Feb 18, 2006
Posts: 99
|
Posted:
Fri Jun 22, 2007 7:50 am |
|
sixonetonoffun wrote: | I don't know that the host will be too fond of someone cheating the limits they have configured and the whole idea may be considered a violation of their user agreement resulting in suspension or termination of the account! |
Just wanted to say that I was recently on ipowerweb chat and the tech support guy actually said this to me regarding how to get around the 50,000 queries limit.
So im guessing your allowed to do it considering he supplied me with the information.
Code:Pete A.: dit the config.php
Pete A.: 23.0
Pete A.: Code:
Pete A.: $db_user = 'your_db_user;
Pete A.: and replace by
Pete A.: Copy to clipboardCode:
Pete A.: $db_user_array[] = "one_db_user";
Pete A.: $db_user_array[] = "other_db_user";
Pete A.: $db_user_array[] = "other_db_user";
Pete A.: $db_user = $db_user_array[ rand( 0, ( sizeof($db_user_array) -1 ) ) ];
|
|
|
|
|
 |
evaders99
Former Moderator in Good Standing

Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Fri Jun 22, 2007 11:26 am |
|
If everyone is doing it and its allowed, why have the SQL limit?  |
_________________ - Only registered users can see links on this board! Get registered or login! -
Need help? Only registered users can see links on this board! Get registered or login! |
|
|
 |
|