Calgarypuck Forums - The Unofficial Calgary Flames Fan Community

Go Back   Calgarypuck Forums - The Unofficial Calgary Flames Fan Community > Main Forums > The Off Topic Forum > Tech Talk
Register Forum Rules FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 12-06-2013, 11:44 AM   #1
CaptainCrunch
Norm!
 
CaptainCrunch's Avatar
 
Join Date: Jun 2002
Exp:
Default PHP help

Hi guys

I'm currently running a web forum at CFLhorsemen.ca. We are using a hosted solution via Fatcow. Lately we've been running into a too many connections error and its happening quite a bit.

I've gone to technical support and they're not willing to increase the concurrent user count beyond 10.

But sent me an article about this issue.

It recommends a couple of things

One is using the mysql_connecct() in php. I am a programming neophyte.

It doesn't explain how to use this command and to insert this script.

It also talks about change the max_connection variable in the my.cnf file. Does anyone know where I would find this?

. I don't even know if I'm providing the right info or asking the right questions.

Thanks!
CaptainCrunch is offline   Reply With Quote
Old 12-06-2013, 12:11 PM   #2
photon
The new goggles also do nothing.
 
photon's Avatar
 
Join Date: Oct 2001
Location: Calgary
Exp:
Default

Since you're using phpBB software, you wouldn't want to get into the actual programming of the forum, the forum software itself is going to use mysql_connect() or similar to connect to the database.. changing phpBB itself is going to be far beyond what you can (or would even want) to do. Using mysql_connect() or similar is dictated from the config file for phpBB.

The other option you mentioned (changing the max_connection variable) sounds like what Fatcow is refusing to do.

That's the downside of shared/hosted solution is once you start to grow you will run very quickly into their limits. They can't have one customer eating all the resources on a server that's supposed to support many. And forum software is about the worst in terms of resource usage.

What version of phpBB are you running? If it's old there might be a bug in the software that's causing it to not release connections when they should and/or improvements that make the software better able to release connections when its done. You might try updating if it's behind in terms of version (which is a big thing, might be easier to move to a better host).

Are you running any add-ons/plugins/etc? Those sometimes can misbehave and take up connections and not release them as it should. Disabling them temporarily to see if things improve might be something to try.

Do you know what version of mysql and php the server is running?

What's the value for the "$dbms =" line in the config.php? mysql? mysqli? If it's 'mysql', and if the server is running fairly recent versions of mysql and php, you can try changing it to mysqli. What that will do is rather than phpBB creating a new connection to the database and then ending it for every request, it'll keep the connections open and reuse them (assuming phpBB takes advantage of this). This can help if the database isn't releasing connections fast enough (which would lead to your too many connections error).

I did a quick search and found lots of ideas to try (disabling some automatic processes of phpBB, installing caching software), but honestly I really think that that would be wasting time, you probably just are hitting the limits of a shared solution and should look for something more robust.
__________________
Uncertainty is an uncomfortable position.
But certainty is an absurd one.
photon is offline   Reply With Quote
Old 12-06-2013, 12:42 PM   #3
CaptainCrunch
Norm!
 
CaptainCrunch's Avatar
 
Join Date: Jun 2002
Exp:
Default

Thanks Photon

I'm running the newest version of phpbb which is 3.0.12.

Its running MySQL(i) 5.5.32-log

As far as addons and plugins I'm not running any, the most I've done mod wise is style changes.

$dbms = 'mysqli';

Yeah as to the programming part, I would be outright terrified of of doing a lot of stuff my the actual db programming. I mean I wrote some styles and buttons and some other features, but nothing in the core of how it communicates with the database.

Again thanks so much for your help.
CaptainCrunch is offline   Reply With Quote
Old 12-06-2013, 12:43 PM   #4
CaptainCrunch
Norm!
 
CaptainCrunch's Avatar
 
Join Date: Jun 2002
Exp:
Default

As a PS even if I converted to vbulletin, I would probably run into the same issue is my host isn't willing to increase connections right
CaptainCrunch is offline   Reply With Quote
Old 12-06-2013, 01:14 PM   #5
CaptainCrunch
Norm!
 
CaptainCrunch's Avatar
 
Join Date: Jun 2002
Exp:
Default

As an addon I went back to my hosting service after they recommended increasing maxconnections and they said they won't do this.

They added this on to their email

t is not possible to increase the max_connect variable in my.cnf. , it appears like at that time you have exceeded the limit and so received the error message. To overcome by exceeding the maximum concurrent connections, please close all open connections in your script when there is no scope for fetching data from database.

Is there a way to do this and what script would I be doing this in?

Thanks
CaptainCrunch is offline   Reply With Quote
Old 12-06-2013, 01:19 PM   #6
photon
The new goggles also do nothing.
 
photon's Avatar
 
Join Date: Oct 2001
Location: Calgary
Exp:
Default

Yeah vbulletin would probably be even worse (as an aside I'd suggest Xenforo if someone is looking for commercial forum software, seems good, don't really like what vBulletin has been doing lately).

Without some further debugging it'd be hard to know what's actually the cause and know what kind of tweaking could maybe alleviate the issue.

You can try to move to a shared host that's more forum friendly, phpbb has some they recommend:

https://www.phpbb.com/hosting/

There's also hosted forums, where someone else does all the work of hosting, presumably they put advertising in to pay for it, might be worth checking. I'm a big fan of having someone else do things

http://www.prophpbb.com/
http://www.phpbbserver.com/

I have no experience with them though so I don't know which one would be good (i.e. one that wouldn't spam your users or keeps their ads to a reasonable level).
__________________
Uncertainty is an uncomfortable position.
But certainty is an absurd one.
photon is offline   Reply With Quote
The Following User Says Thank You to photon For This Useful Post:
Old 12-06-2013, 01:35 PM   #7
CaptainCrunch
Norm!
 
CaptainCrunch's Avatar
 
Join Date: Jun 2002
Exp:
Default

Thanks

That's awesome
CaptainCrunch is offline   Reply With Quote
Old 12-06-2013, 01:38 PM   #8
photon
The new goggles also do nothing.
 
photon's Avatar
 
Join Date: Oct 2001
Location: Calgary
Exp:
Default

Quote:
Originally Posted by CaptainCrunch View Post
As an addon I went back to my hosting service after they recommended increasing maxconnections and they said they won't do this.

They added this on to their email

t is not possible to increase the max_connect variable in my.cnf. , it appears like at that time you have exceeded the limit and so received the error message. To overcome by exceeding the maximum concurrent connections, please close all open connections in your script when there is no scope for fetching data from database.

Is there a way to do this and what script would I be doing this in?

Thanks
This would be something deep inside the phpBB software and wouldn't be something that you could easily change, and wouldn't want to since the phpBB software itself does what they're saying to do anyway. Sounds like they have little to no experience with forum software.

Since it is using mysqli it actually keeps the connections open on purpose so it doesn't have to close and reopen them, but at some point more than 10 connections are needed and it's trying to get the 11th and gets the error.

Why it needs the 11th is the question here. If it's because the forum is just getting too busy for such a low limit, then there's not much you can do. There is a way you could try and get around the limit, but that might rise the ire of your host (I'll mention that at the end).

There's lots of other possible reasons it needs the 11th. It could be that the entire machine is overworked and the database is taking too long to respond to queries, so requests get backed up waiting for the database. It could be that someone has decided to attack the forum and that is tying up database connections. Plus a bunch of others. One would have to debug the issue (requires good experience in such things, more on the sysadmin level though) to determine what it was to know what to try.

You can try doing a check and repair on the mysql forum tables, if there's something wrong there it might be causing the database to respond slowly.

You could ask them if they can set the max-persistent variable, that might help in that at least it might not give an error and will either just wait for a connection or at least give a forum busy type message. http://www.php.net/manual/en/mysqli....max-persistent

Did you create the mysql username and password for the forum? Reason I ask is because if you did, there is a way to maybe get around the limit but they probably wouldn't like it too much. If you created the ID and password, you can create another ID with the same password and the same access to the forum database, and then in the config you can make it so it'll choose randomly to use one or the other. If the connections are limited based on user ID then that'll double your available connections.

https://www.phpbb.com/community/view...f=46&t=2102502

But still sounds like you'd be better off moving to either a host that understands forums better and wants to support them, or a hosted solution that worries about all the details for you.

EDIT: Or if you have someone that knows Linux and sysadmin type stuff, you could setup a VPS and then you'd have full control over the system.
__________________
Uncertainty is an uncomfortable position.
But certainty is an absurd one.
photon is offline   Reply With Quote
Old 12-06-2013, 02:21 PM   #9
FlamesPuck12
First Line Centre
 
Join Date: Apr 2007
Exp:
Default

As photon mentioned, it might be worth while to setup a VPS to host your phpbb.

For VPS, I suggest using Linode or DigitalOcean. Setting up software like phpbb is well documented so it shouldn't be too difficult.

Example: https://library.linode.com/web-appli...ecise-pangolin
FlamesPuck12 is offline   Reply With Quote
Old 12-06-2013, 02:37 PM   #10
CaptainCrunch
Norm!
 
CaptainCrunch's Avatar
 
Join Date: Jun 2002
Exp:
Default

Thanks guys this is great.

The first thing I'm going to do is reach out to the dedicated forum hosts and let them know what I'm struggling with and see if their service address those.

The big worry for me is if I move is getting my board configuration, users and post history to a new board

Like I said I'm a bit of a neophyte
CaptainCrunch is offline   Reply With Quote
Old 12-06-2013, 02:38 PM   #11
FlamesPuck12
First Line Centre
 
Join Date: Apr 2007
Exp:
Default

Quote:
Originally Posted by CaptainCrunch View Post
Thanks guys this is great.

The first thing I'm going to do is reach out to the dedicated forum hosts and let them know what I'm struggling with and see if their service address those.

The big worry for me is if I move is getting my board configuration, users and post history to a new board

Like I said I'm a bit of a neophyte
Moving users and post history should be straight forward. If phpbb is using MySQL, you can use mysqldump to get a dump of your current DB and then replay the output on a new MySQL instance elsewhere.

Reference: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
FlamesPuck12 is offline   Reply With Quote
Old 12-06-2013, 03:19 PM   #12
CaptainCrunch
Norm!
 
CaptainCrunch's Avatar
 
Join Date: Jun 2002
Exp:
Default

Thanks

I went to PHPBB and it was quite funny, they basically stated that my hoster was full of crap. So I have both sides blaming each other.

They gave me a link and instruction to do a fresh install of PHPBB that they know does close connections that will let me retain my users styles and everything else.

I've gone back to my host with the instuctions because a database updater has to be run from the root and I don't think I've got admin rights to do that.

I don't know if it will fix it, but its a first step

If this doesn't work I've contacted the hosting companies provided above with questions and it might be a way to go because FatCow doesn't seem to know much.

Anyways thanks again guys for all of this.
CaptainCrunch is offline   Reply With Quote
Old 12-09-2013, 05:34 PM   #13
CaptainCrunch
Norm!
 
CaptainCrunch's Avatar
 
Join Date: Jun 2002
Exp:
Default

Thanks for everything guys, we transitioned of to prophbb.com and it was a pretty easy transition, with 1000 concurrent connects instead of 10th.

Hopefully our problems are over.
CaptainCrunch is offline   Reply With Quote
Old 12-09-2013, 06:06 PM   #14
photon
The new goggles also do nothing.
 
photon's Avatar
 
Join Date: Oct 2001
Location: Calgary
Exp:
Default

Well at least until you get too big for them
__________________
Uncertainty is an uncomfortable position.
But certainty is an absurd one.
photon is offline   Reply With Quote
Old 12-09-2013, 07:23 PM   #15
CaptainCrunch
Norm!
 
CaptainCrunch's Avatar
 
Join Date: Jun 2002
Exp:
Default

Well that would be groovy.

I didn't think I'd outgrow the last one, but apparently there are a lot of CFL fans.
CaptainCrunch is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 10:00 PM.

Calgary Flames
2023-24




Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Calgarypuck 2021