Jump to content

Archived

This topic is now archived and is closed to further replies.

jhale1966

Too Many Connections accessing MySQL from PHP

Recommended Posts

Greetings!

 

I am Soooooo glad I found this site. :) It actually helped me finish my Game Project (http://www.dk-tower.com) but while working on it, I ran into some issues.

 

While looking at the code (which I based on the Membership System Tutorial v1) , there seem to be an awful lot of hits to the database and at times, the website (game & support site itself) show MySQL errors (Too Many Connections).

 

Is there something I can do to optimize the code so that it doesn\'t do this?

 

Thanks! :)

Share this post


Link to post
Share on other sites

Use persistent connections.

 

If you use MySQL, instead of connecting to the MySQL server with mysql_connect(), use mysql_pconnect(). This might help.

 

JP.

Share this post


Link to post
Share on other sites

I was wondering about that. What happens if a person gets into the game, opens the connection and then leaves? Does the next person open a new connection or do they just \'piggyback\' onto the existing one?

Share this post


Link to post
Share on other sites

I am not sure whether a pconnect would help

 

but for sure u have to increase the mysql connection which can be done by changing the config file.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.