mysql_pconnect(): Too many connections

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • n8f8
    Junior Member
    • Oct 2004
    • 5

    mysql_pconnect(): Too many connections

    Someone on my shared server is hosing my site. I know my site isn't sucking all the bandwith. I checked my status logs. Earlier I couldn't even access my site, now I get the error "mysql_pconnect(): Too many connections". Please boot these bandwith-sucking loozers.


  • Buddha
    Senior Member
    • Mar 2004
    • 825

    #2
    No one should be using mysql_pconnect() on a shared server. If you can't connect to your database mysql_pconnect() could be the reason.

    [ edit - to correct double negative ]
    Last edited by Buddha; 10-01-2004, 07:11 AM.
    "Whatcha mean I shouldn't be rude to my clients?! If you want polite then there will be a substantial fee increase." - Buddha

    Comment

    • n8f8
      Junior Member
      • Oct 2004
      • 5

      #3
      I just changed it to mysql_pconnect to try to solve the problem.

      Comment

      • AndrewT
        Administrator
        • Mar 2004
        • 3653

        #4
        Please do not use persistent connections. They should be disabled anyways but if we catch someone using them it will result in the domain being suspended.

        Comment

        • n8f8
          Junior Member
          • Oct 2004
          • 5

          #5
          I just changed the mysql_connect to mysql_pconnect to fix the broken server in the first place. Now my other site www.scsclub.com is dead and won't even resolve. If I could FTP to the site I'd change it back.
          Last edited by AndrewT; 10-01-2004, 08:12 AM.

          Comment

          • AndrewT
            Administrator
            • Mar 2004
            • 3653

            #6
            Once again your post has been edited for language. One more time and you will no longer be posting here.

            Comment

            • sdjl
              Senior Member
              • Mar 2004
              • 502

              #7
              n8f8, just so you know why mysql_pconnect(); is bad, here's an excert from the PHP manual, which can be viewed here: http://php.net/mysql_pconnect

              The connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()).
              This basically means that a process on the server will constantly be open to the MySQL server using the login details you gave it.
              So why is this bad on a shared server? Another excert, this time from an article on http://www.zend.com

              The mysql_pconnect() function was designed to provide a mechanism for reducing the cost of establishing and closing connections to the MySQL server. Unfortunately, due to an interaction between the architecture of the Apache server and the architecture of PHP, high traffic on a site that used pconnects could quickly clog up the MySQL server with many unused connections that could prevent many of the active connections from accessing the database.
              There's not a great deal of detail in the PHP manual as to why using pconnect could be bad, so it's always useful to take these notes (and warnings) in your stride and remember them for next time

              I hope this helps clarify anything that you may not have understood. If you need to ask any questions about the function, fire away

              David
              -----
              Do you fear the obsolescence of the metanarrative apparatus of legitimation?

              Comment

              Working...