Page 1 of 1

Problem with persistent SQL connections

Posted: Tue 11. May 2004, 09:45
by jtnygren
Hello!

At least in include/inc_lib/default.inc.php you use pconnect to connect to database. This is problem with couple big webhotell organisation in Finland.

Do you have any patch to change phpWCMS to use connect instead of pconnect? Or could you tell is default.inc.php only place where you connect to SQL?

If there is no reasons to use persistent connections, I think it would be better to use standard database connections.

http://fi2.php.net/manual/fi/function.m ... onnect.php
http://fi2.php.net/manual/fi/function.mysql-connect.php

Thanks, Jakob

Posted: Tue 11. May 2004, 09:59
by pSouper
i think you have the choice to use persistent connections (set in include/inc_conf.php) set this to 0 for non-persistent & 1 for persistent.

unless this is not the effect you are after?

Posted: Tue 11. May 2004, 10:02
by DeXXus
This is asked as a question during setup (whether to use "persistent" connections or not)... but you should be able to modify "config.inc.php" line:
FROM:
// database values
$phpwcms["db_pers"] = 1;
TO:
// database values
$phpwcms["db_pers"] = 0;
This will trigger the code in "default.inc.php":
// open the connection to MySQL database
if($phpwcms["db_pers"] == 1) {
$db = mysql_pconnect($phpwcms["db_host"],$phpwcms["db_user"],$phpwcms["db_pass"]) or die("Error while trying to connect to ".$phpwcms["db_host"]);
} else {
$db = mysql_connect($phpwcms["db_host"],$phpwcms["db_user"],$phpwcms["db_pass"]) or die("Error while trying to connect to ".$phpwcms["db_host"]);

Posted: Tue 11. May 2004, 10:06
by pSouper
I'm guessing you answer took way longer than the 3 min time diff between our posts :). don't you just hate it when you construct the definitive answer to the problem and little guy sneakes in the backdoor and get the short/ambiguous version in befroe you :D

Posted: Tue 11. May 2004, 10:13
by DeXXus
HeHe... You're S-L-I-C-K like that :lol:
Answers explained different ways will hopefully be helpful... anyways :wink:

Posted: Tue 11. May 2004, 10:26
by pSouper
your are so right. the same point viewed from different angles will give a new dimention to the solution.

Posted: Mon 20. Sep 2004, 19:22
by sporto
Even four months later, both answers helpped me. Thanks!