php forum
php mysql forum
php mysql smarty
 
Topic Options
#216583 - 05/10/02 12:33 AM Too many connections
3DSHROOM_dup1 Offline
Journeyman

Registered: 04/17/02
Posts: 108
Loc: Texas
On our old server our users often got the MySQL "Too many connections" error. Since we have moved to our new one this has virtually disappeared, but.... <br /> <br />We usually have 100+ users at peak times with 318,273 total posts in the main database and 269,158 total in a read only archive database. I would really love to merge these again, but I don't want these errors. I have checked mysql and php config files and they both have persistant connections set at unlimited with apache at 200. <br /> <br />I think you should add a little better error handling for the mysql connection in mysql.inc.php. Maybe you can work with this code. <br /> <br /><pre><font class="small">code:</font><hr> <br />if ($this->dbh == 0) <br />{ <br /> for($i=0; $i<5; $i++) <br /> { <br /> if ($config[persistent] == "off") <br /> { <br /> if (($this->dbh=mysql_connect($config['dbserver'],$config['dbuser'],$config['dbpass']))>0) <br /> break; <br /> } <br /> else <br /> { <br /> if (($this->dbh = mysql_pconnect($config['dbserver'],$config['dbuser'],$config['dbpass']))>0) <br /> break; <br /> } <br /> sleep(2); <br /> } <br />} <br /></pre><hr> <br /> <br /> <br />.. or maybe you could just check for that type or error and make it sleep/retry.


Edited by 3DSHROOM (05/10/02 12:36 AM)
_________________________
SacredShrooms.org

Top


Who's Online
0 registered (), 22 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Wisdom needed
by Gizmo
Yesterday at 10:54 AM
How to hide sub forums from summary page
by blaaskaak
12/03/08 09:54 AM
Spell Check [beta]
by Bill B
12/01/08 09:16 PM
PhotoPost BB Code Popup
by AllenAyres
12/01/08 09:41 AM
Problems reading a lot of old posts here
by AllenAyres
12/01/08 09:35 AM
Forum 'Trader Ratings'.
by AllenAyres
12/01/08 09:33 AM
Customization needed
by Gizmo
11/12/08 12:28 PM
New Mods
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Spell Check [beta]
by
10/17/06 09:24 PM
Newest Members
Truth, David DelMonte, nick1, Begbie, cenk
13364 Registered Users
Top Posters
AllenAyres 25452
JoshPet 11330
Rick 8372
LK 7396
Lord Dexter 6503
Greg Hard 5533
Charles Capps 5438

 

 

 
fusionbb message board php hacks