'max user connections' problem

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
xxronis
Forum Newbie
Posts: 4
Joined: Wed Jun 20, 2007 2:52 pm

'max user connections' problem

Post by xxronis »

Hi there ,
i get this after a few clicks -queries

Warning: mysql_pconnect() [function.mysql-pconnect]: User 'that_User' has already more than 'max_user_connections' active connections in /home/that_User/public_html/New/Connections/cone.php on line 9

Fatal error: User wwwboat_xrono1 has already more than 'max_user_connections' active connections in /home/that_user/public_html/New/Connections/cone.php on line 9


//cone.php//
$hostname_cone = "localhost";
$database_cone = ".....";
$username_cone = ".....";
$password_cone = "......";
$cone = mysql_pconnect($hostname_cone, $username_cone, $password_cone) or trigger_error(mysql_error(),E_USER_ERROR); //line9//
mysql_select_db($database_cone, $cone);


and i call this script like this: <?php require_once('Connections/cone.php'); ?> in every .php file in the site


Why is this happening .i use permanent db connection,and i know my server 'max user connections' is 25 which is ok

the thing that worries me is that this is happening more some hours of the day,i don't know if it's my fault or what
the site is not indexed,no robots to take the user connections or something

please help
thanks 8O
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Might want to use mysql_connect rather than mysql_pconnect. Looks like the connections are not getting closed.
xxronis
Forum Newbie
Posts: 4
Joined: Wed Jun 20, 2007 2:52 pm

Post by xxronis »

astions wrote:Might want to use mysql_connect rather than mysql_pconnect. Looks like the connections are not getting closed.
i get the same warning and error with mysql_connect---before with one or two reloads i would get the page

Now nothing

i just free the resultsets,how the connection closes

thanks
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Is this the result of shared hosting...?

Try calling mysql_close() every once in a while. I usually have it called in the __destruct() method of my SQL class.
xxronis
Forum Newbie
Posts: 4
Joined: Wed Jun 20, 2007 2:52 pm

Post by xxronis »

i don't think it is a matter of shared hosting,
really no big deal static sites and a couple of no much consuming db's
i worked there..

After all i see on the server side 'max connections' are 500 .
xmm..
what do you think?

give example mysql_close()
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Code: Select all

mysql_close($openConnectionHandler);
xxronis
Forum Newbie
Posts: 4
Joined: Wed Jun 20, 2007 2:52 pm

Post by xxronis »

I thing i solved the problem

i had mysql_select_db toooo many times in the scripts
i think this was taking over the connections

everything looks great now still using mysql_pconnect


just wait and see how this will work in the real world!!(u know the web)

thanks guys :D
Post Reply