Topic: Error connecting to DB

I Installed the forum on my page succesfully. However after creating the config.php and moving this to the correct directory I cannot connect to the database (although the forum has succesfully created the correct tables..). All i get when going to:

http://www.knmserver.com/vwreck/forum/index.php

Is:

An error was encountered
File: 57
Line: /home/content/k/n/m/knmserver/html/vwreck/forum/include/dblayer/mysql.php

PunBB reported: Unable to connect to MySQL server. 

(Yes, I am using the debug mode to get this message).

I contacted my webspace provider and they said they figure its a global issue and are working on setting this up. However is there anyway I could get around this somehow. I need this up now and not in 2 months...

Re: Error connecting to DB

That's odd. Are you using the latest version of PunBB? The error message shouldn't occur on line 57 if you are running PunBB 1.1 or 1.1.1. Also, that error message should be followed the error message supplied by MySQL (mysql_error()). Perhaps your host has disabled it or something.

If you host says that they are having problems, I don't believe there is anything you can do to fix it. Well, anything short of changing hosts that is.

One thing you can try is to change the variable pconnect in config.php from true to false. See if that helps.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Error connecting to DB

Thansk for the true to false tip! It seems to have resolved the problem (least for now). If you don't mind me asking what is the diffrence in having this set to true and vice versa? (always keen to find out things while learning smile )

Re: Error connecting to DB

When pconnect is set to true, PunBB connects to MySQL via a so called persistent connection. A persistent connection isn't closed at the end of the script and can be reused for several script executions. The benefit is that a new connection doesn't have to be established every time. However, since the connections doesn't die at the end of the scripts, MySQL will run out of available connections quite fast. That is what happened on your host.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5

Re: Error connecting to DB

Thanks. I use Tera-Byte.com and was getting an error:

"Error: Unable to connect to MySQL server. User user@localhost.localdomain has already more than 'max_user_connections' active connections. "


That little bit of info solved my problem.

Re: Error connecting to DB

I will probably change the default from true to false in the next version.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Error connecting to DB

Or maybe add this as a selection in the install script? just an idea...

Re: Error connecting to DB

Wolfsbane wrote:

Or maybe add this as a selection in the install script? just an idea...

I'm not sure. I think 99% of the people installing PunBB will have no idea which one to choose. The people who know enough will surely be able to just edit config.php.

"Programming is like sex: one mistake and you have to support it for the rest of your life."