WordPress.org

Ready to get started?Download WordPress

Forums

persistent database connections (5 posts)

  1. jghjgjghjmn
    Member
    Posted 4 years ago #

    I have several installs of various WP verions on a web server connecting to MySQL on a different host. These installs are maintaining persistent database connections. This is a problem as the DNS can change on the MySQL server and these installs keep the old.

    The file wp-db.php doesn't have the call mysql_pconnect, but have the normal mysql_connect

    We have a number of installs with the same host for both web and DB (same MySQL as above) and they don't have the same issue.

    Any suggestions on cause/solution?

  2. Samuel B
    moderator
    Posted 4 years ago #

    try adding this to wp-config.php

    define('USE_PCONNECT', 'false');

  3. MichaelH
    Member
    Posted 4 years ago #

    Is that right Sam? I don't find USE_PCONNECT in the core files...

  4. Samuel B
    moderator
    Posted 4 years ago #

    it does look like it's a relic

    but should work if you add this to wp-db.php

    if (USE_PCONNECT == 'false') {
     $link = mysql_pconnect($server, $username, $password);
     } else {
     $link = mysql_connect($server, $username, $password);
     }

    or maybe I'm in over my head :>)

  5. zahidraf
    Member
    Posted 4 years ago #

    I am running zahipedia.com
    Web site and getting this issue. site is temporally down

    I called to hosting and they said all open connection has been used in the sites. when I checked and find the WordPress is using mysql_connect

    should I use mysql_pconnect to avoid this issue

    Any suggest

    Thanks in advance

Topic Closed

This topic has been closed to new replies.

About this Topic