Problem with persistent SQL connections

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
jtnygren
Posts: 10
Joined: Sun 28. Mar 2004, 14:38
Location: Nokia, Finland

Problem with persistent SQL connections

Post 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
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post 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?
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post 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"]);
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post 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
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

HeHe... You're S-L-I-C-K like that :lol:
Answers explained different ways will hopefully be helpful... anyways :wink:
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

your are so right. the same point viewed from different angles will give a new dimention to the solution.
sporto
Posts: 160
Joined: Mon 10. Nov 2003, 18:01
Location: USA, Chicago

Post by sporto »

Even four months later, both answers helpped me. Thanks!
Post Reply