Page 1 of 1

'max user connections' problem

Posted: Wed Jun 20, 2007 3:00 pm
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

Posted: Wed Jun 20, 2007 3:09 pm
by Benjamin
Might want to use mysql_connect rather than mysql_pconnect. Looks like the connections are not getting closed.

Posted: Wed Jun 20, 2007 3:30 pm
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

Posted: Wed Jun 20, 2007 4:42 pm
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.

Posted: Wed Jun 20, 2007 5:11 pm
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()

Posted: Wed Jun 20, 2007 5:17 pm
by superdezign

Code: Select all

mysql_close($openConnectionHandler);

Posted: Thu Jun 21, 2007 3:37 pm
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