Jump to content


Too Many Connections accessing MySQL from PHP

  • Please log in to reply
3 replies to this topic

#1 jhale1966

  • Members
  • PipPip
  • Member
  • 19 posts

Posted 09 June 2003 - 02:06 PM


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! :)

#2 barbatruc

  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationMontreal, Quebec, Canada

Posted 09 June 2003 - 04:11 PM

Use persistent connections.

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

Unfortunately, PHP \'empowered every moron with a copy of Windows notepad to be \"web programmers\". (...) Give PHP a real INFRASTRUCTURE. Use PEAR!!!\'

#3 jhale1966

  • Members
  • PipPip
  • Member
  • 19 posts

Posted 10 June 2003 - 12:25 PM

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?

#4 shivabharat

  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 10 June 2003 - 04:47 PM

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.
Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users