Persistent Connection

admin

Administrator
Staff member
I created a help desk ticket and got a response from TCH-Carl. He's given me a rundown of how persistent connections work and how TCH deals with open connections and such. He recommended I ask here on the<br />forums for help.<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->You are using persistent connection to the server and hece each time the script is invoked, it might create a new session. You need to remove the persistent connection option and make sure that all database sessions are killed after script execution. You can get more information about this from other members of the forum who are using such scripts. Just post your request here<!--QuoteEnd--></div><!--QuoteEEnd-->The program I use is <a href="http://www.c97.net/dl/index.php?act=category&id=3" target="_blank">Directory97 PRO</a> which is a Links Directory script.<br /><br />Is anyone familiar with knowing how to change the persistent connection option to a regular one or whatever the term would be called for a non-persistent connection? <br /><br />I actually requested help on the forums for Directory97 PRO and this is the response I got from the creator: <a href="http://www.c97.net/forum/viewtopic.php?t=1245" target="_blank">click here</a><br /><br />I do enjoy this script and would like to use it, so if anyone can help me resolve this issue, I'd be grateful. The error I get is<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Warning: mysql_pconnect() [function.mysql-pconnect]: User xxxxxxx_xxxxxxx has already more than 'max_user_connections' active connections in /home/xxxxxxx/public_html/directory/includes/config.php on line 14<br /><br />User xxxxxxx_xxxxxxx has already more than 'max_user_connections' active connections<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Thanks! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tchrocks!.gif" style="vertical-align:middle" emoid=":tchrocks!:" border="0" alt="tchrocks!.gif" /><!--content-->
I had a look several times, but can't get to the web site with the code (from your link - the site appears down, so obviously not hosted with us <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> ) <br />Without looking at the way that it's coded, I can't really suggest how to modify it I'm afraid. Hopefully the site will be reachable at some point.<!--content-->
Hi Andy!<br /><br />Are you trying to download the program itself? I just tried a few minutes ago and it worked.<br /><br /><a href="http://www.c97.net/dl/index.php?act=download&id=5" target="_blank">http://www.c97.net/dl/index.php?act=download&id=5</a><br /><br />From the error, I know I need to change the config.php, but curiousity makes me wonder if I need to change more than just that.<!--content-->
I can't get to it either from Florida.<br /><br />*edit...just came up...running very slow.<!--content-->
Locate the following in /public_html/directory/includes/config.php<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// initialize database<br />if (!$dbh=mysql_pconnect ($db_hostname, $db_username, $db_password)) { echo mysql_error (); exit; }<br />mysql_select_db($db_name, $dbh);<!--c2--></div><!--ec2--><br />and change to <br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// initialize database<br />if (!$dbh=mysql_connect ($db_hostname, $db_username, $db_password)) { echo mysql_error (); exit; }<br />mysql_select_db($db_name, $dbh);<!--c2--></div><!--ec2--><br /><br />The config file appears to be created by the script so whenever you update the script make sure you check config.php.<!--content-->
And he tells me to change servers, lol. Maybe I should tell him about TCH! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/yes.gif" style="vertical-align:middle" emoid=":yes:" border="0" alt="yes.gif" /><!--content-->
<!--quoteo(post=192117:date=Oct 12 2006, 05:20 PM:name=TCH-Dick)--><div class='quotetop'>QUOTE(TCH-Dick @ Oct 12 2006, 05:20 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=192117"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->Locate the following in /public_html/directory/includes/config.php<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// initialize database<br />if (!$dbh=mysql_pconnect ($db_hostname, $db_username, $db_password)) { echo mysql_error (); exit; }<br />mysql_select_db($db_name, $dbh);<!--c2--></div><!--ec2--><br />and change to <br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// initialize database<br />if (!$dbh=mysql_connect ($db_hostname, $db_username, $db_password)) { echo mysql_error (); exit; }<br />mysql_select_db($db_name, $dbh);<!--c2--></div><!--ec2--><br /><br />The config file appears to be created by the script so whenever you update the script make sure you check config.php.<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Is this the recommended fix for phpBB???<!--content-->
Also, is it possible to edit the php.ini to disable pconnect???<br /><br />Thanks,<br /><br />Don<!--content-->
Try adding the following to .htaccess<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->php_flag mysql.allow_persistent off<!--c2--></div><!--ec2--><br /><br />If we're allowed to override it, it should cause php to treat a call to mysql_pconnect() the same as mysql_connect().<!--content-->
 
Top