Thread:Project:Support desk/Won't Access Database: Too many open links/reply (5)

Hi Steve,

TPP Wholesale MySQL servers have a "20 concurrent connections" limit per MySQL user to prevent heavy MySQL load on the server and to identify scripts that use unnecessary MySQL connections due to bad coding practices.

These errors can be prevented by making some tweaks in your code:

1. Use of mysql_connect for connections to MySQL databases in your code. The advantage is the link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling mysql_close. A detailed explanation can be found at http://us3.php.net/manual/en/function.mysql-connect.php

2. Use of mysql_close explicitly. Although mysql_connect closes the connections, use of mysql_close in conjunction with it would make sure that the connection is totally closed.

3. Prevent use of mysql_pconnect. The disadvantage is the connection to the MySQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use. Please note: mysql_close will not close links established by mysql_pconnect.

Please take note of the following details.

List of files with mysql_pconnect: soso15411@shell:/clientdata/ap

ache-www/s/o/solidarity.coop/www$ grep -rl mysql_pconnect. ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php ./mediawiki-back/includes/db/DatabaseMysql.php ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php ./wiki-back/includes/db/DatabaseMysql.php ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php ./wiki/includes/db/DatabaseMysql.php

Instances of mysql_connect: /clientdata/apache-www/s/o/solidarity.coop/www$ grep -rl mysql_connect. ./mediawiki-back/netreginstall

/db-util.php ./mediawiki-back/HISTORY ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php ./mediawiki-back/includes/db/DatabaseMysql.php ./wiki-back/netreginstall/db-util.php ./wiki-back/HISTORY ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php ./wiki-back/includes/db/DatabaseMysql.php ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php ./wiki/includes/db/DatabaseMysqli.php ./wiki/includes/db/DatabaseMysql.php ./wiki/HISTORY

Instances of mysql_close: grep -rl mysql_pconnect. ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php ./mediawiki-back/includes/db/DatabaseMysql.php ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html aarney@shell:~$ setdomain solidarity.coop soso15411@shell:/clientdata/apache-www/s/o/solidarity.coop/www$ grep -rl mysql_close. ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php ./mediawiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php ./mediawiki-back/includes/db/DatabaseMysql.php ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php ./wiki-back/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php ./wiki-back/includes/db/DatabaseMysql.php ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php ./wiki/extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php ./wiki/includes/db/DatabaseMysql.php

Unfortunately, I cannot make any changes to this number, and it is most likely something you should take up with the mediawiki developers as this is an issue with the way the site is coded.

Kind Regards, Alex

TPP Wholesale Support Team