SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy HELP ! PHP errror - site down

    Hi,

    I just tried to visit my site and got the following error:

    Warning: mysql_connect(): Too many connections in /home/httpd/vhosts/workincairns.com/httpdocs/connect.php on line 2
    Too many connections

    Can ANYONE please tell me whats happenned and how to fix it ?

    http://www.workincairns.com

  2. #2
    SitePoint Addict
    Join Date
    Jul 2004
    Location
    The Caribbean
    Posts
    267
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Usually that means that your site is busy and you are hitting a limit on the number of mysql connections to the database (usually this limit is set by your web host). If you have access to your logs, you should check and see if that is really the case, and also get in touch with your host.

  3. #3
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Seems to be working OK now. Keep a check on your logs and also any files that call to the database reguarly. I had a similar problem caused by a stats program that had gone nuclear and called the database far to many times!

    Mike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #4
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My site is back up online...

    I just got an email from my host saying:

    Thanks for letting us know. I have fixed the problem. Please let me know if you see this occurring again.

    I have just been made aware that my php pages should always end in a mysql close statement. However after the email from my host....

    Maybe it wasnt my fault?

  5. #5
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    possibly wasn't, keep a close eye on them!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  6. #6
    SitePoint Evangelist Will Kelly's Avatar
    Join Date
    May 2005
    Location
    London
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's good practice to clear mysql results but it is done automatically at the end of script execution anyway.

  7. #7
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Will Kelly
    It's good practice to clear mysql results but it is done automatically at the end of script execution anyway.
    Well it isn't really a good practice either. No need to close something that is going to be close by the script automatically.

  8. #8
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Not all scripts are closed automatically. It kinda depends on the server setup and if your server isn't playing, your script could screw up and run an infinite loop......

    So although it's not 'good practice' persay,it is polite!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  9. #9
    SitePoint Addict n0other's Avatar
    Join Date
    Feb 2005
    Posts
    290
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ReptileMan
    Well it isn't really a good practice either. No need to close something that is going to be close by the script automatically.
    It's not guaranteed that it will be closed, it's a good practice to close it manually.

  10. #10
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Too many connections.

  11. #11
    SitePoint Evangelist Will Kelly's Avatar
    Join Date
    May 2005
    Location
    London
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ReptileMan
    Well it isn't really a good practice either. No need to close something that is going to be close by the script automatically.
    MySQL results use up memory. So if you do a number of large queries it's a good idea to close ones you've finished with to free up memory.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •