You are here: max_connections exceeded « PHP SQL « IT news, forums, messages
max_connections exceeded

Posted by Phil Steer on 02/07/07 10:25

I have just had a mySQL database added to my hosting account (NetNation) and
am experimenting with building an HTML page from the database using PHP.
However, although my test works (the page displays as expected), when I
request the test page multiple times I get the error:

Warning: mysql_connect(): User 'username' has exceeded the 'max_connections'
resource (current value: 10)

It then takes hours for the connections to timeout.

As far as I can see there is nothing wrong with my PHP code, which uses
mysql_close to explicitly close the connection opened with mysql_connect:

<?php
$db = mysql_connect( "hostname", "username", "password" ) ;
mysql_select_db( "database", $db ) ;
$sql = "SELECT * FROM articles" ;
$res = mysql_query( $sql, $db ) ;
echo "<html>" ;
echo echoHead( mysql_result( $res, 0, "title" )) ;
echo "<body>" ;
echoBorderTop() ;
showImage( mysql_result( $res, 0, "text" ), mysql_result( $res, 0,
"image" )) ;
echoBorderBottom() ;
echo "</body>" ;
echo "</html>" ;
mysql_close( $db ) ;
return ;
?>

(echoHead, echoBorderTop, showImage, and echoBorderBottom are simply
functions that I have written to help build the page - they make no calls to
database functions themselves)

Any suggestions as to the cause of the exceeded connections problem would be
much appreciated. Many thanks.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация