SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot JagXJ220's Avatar
    Join Date
    Mar 2001
    Location
    Not worth the drive
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lately I've been having troubles with my mySQL databases. I include the page http://thunder3.cwihosting.com/~super/connectinc.php3 on all of my pages using the require() function to connect to my database. Lately though, whenever I go to my site, it gives me errors like this:

    Warning: MySQL Connection Failed: Too many connections in /home/super/public_html/connectinc.php3 on line 2

    Since all of my content is in mySQL, these errors make my site useless, so I need to get the problem fixed as soon as possible. Are these problems likely my host's fault, or am I just getting too many visitors for my site to handle?(I get about 1,300 uniques per day and about 20,000 page views per day)

  2. #2
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,
    I'm not sure, but do you use mysql_pconnect? According to Luke Welling and Laura Thomson, authors of the book "PHP and MySQL Web Development", when you use mysql_pconnect, "This saves time and server overhead".

    John

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should try and use persistent connections - mysql_pconnect() Check your php configeration - php_info() - to see whether persistent connections are turned on. Some shared hosts will turn persistent connections off because it ties up connections (which is good for you, but bad for the host if they are trying to serve lots of virtual accounts with the one mysql server). Your mysql server may not even be on the same server as your web site. So, the problem could be that the web host is serving too many sites with the one mysql server. You should contact your host and see if they can improve matters for you. I think this is one of the real frustrations of using shared hosting.

  4. #4
    SitePoint Zealot JagXJ220's Avatar
    Join Date
    Mar 2001
    Location
    Not worth the drive
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql_pconnect()

    So if I use mysql_pconnect(), then it would have a better chance of working than using mysql_connect()?

  5. #5
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It is worth doing benchmarks to determine whether mysql_pconnect or mysql_connect is the more efficient solution in your particular situation.

    http://www.php.net/manual/features.p...onnections.php
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff


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
  •