WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Shardb: problem with db.php file (10 posts)

  1. signy
    Member
    Posted 3 years ago #

    Two questions regarding the db.php file to be inserted as part of the Shardb Plugin.

    1. Per the instructions, I am supposed to add “$enable_home_db = true;” to the config area of db-settings.php. Where is the config area?

    2. When I install the db.php file per the instructions, I get the following error message:

    Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:3306 (Connection refused) in /home/SITE/public_html/wp-content/db.php on line 521
    Connected to localhost:3306 but unable to select database 'DATABASE_NAME' while querying table 'XX_sitemeta' (global_r)
    Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:3306 (Connection refused) in /home/SITE/public_html/wp-content/db.php on line 521
    Connected to localhost:3306 but unable to select database 'DATABASENAME_global' while querying table 'XX_blogs' (global_r)
    Warning: Cannot modify header information - headers already sent by (output started at /home/SITE/public_html/wp-content/db.php:521) in /home/SITE/public_html/wp-includes/ms-settings.php on line 94

    Lines 521 to 527 of dh.php read:

    $socket = fsockopen($host, $port, $errno, $errstr, $float_timeout);
    if ( $socket === false ) {
    if ( $use_apc )
    apc_store($apc_key, 'down', $apc_ttl);
    $this->tcp_responsive = "false [ > $float_timeout] ($errno) '$errstr'";
    return false;
    }

    Line 94 of ms-settings.php reads:

    header( 'Location: ' . $destination );

    Does anyone have any ideas on how to fix this?

    Thanks!

  2. Ron Rennick
    MultiSite Guru
    Posted 3 years ago #

    Did you edit your wp-config.php & migrate your data using the migration script provided?

    The config file for SharDB is db-settings.php. Sample settings are near the top of db-settings.php in a commented out section.

  3. signy
    Member
    Posted 3 years ago #

    Hi,

    I did edit the wp-config file and successfully migrated the databases and sites.

    I also made the db-settings.php changes and uploaded that.

    I created a "_home" database so wanted to edit the db.php file. Where in the db.php file do I place this code: “$enable_home_db = true;”

    Finally, when I added the db.php file, without the “$enable_home_db = true;” code, I got the error message noted above.

    Thanks for your help!

  4. Ron Rennick
    MultiSite Guru
    Posted 3 years ago #

    You don't edit db.php. The only file you edit is db-settings.php.

    Note I said above that the sample settings in db-settings were commented out. You need to move/copy the configuration lines outside the /* */

  5. signy
    Member
    Posted 3 years ago #

    Thanks so much for your help and clarification.

    Just edited db-settings to uncomment that line.

    I still get the error message above after moving the db.php file into wp-content. I was able to remove that error message only by removing both the db.php and shardb-admin.php files.

    Is there a way to get these two files to work? If not, will the plugin run without these two files?

    Thanks!

  6. Ron Rennick
    MultiSite Guru
    Posted 3 years ago #

    Did you check the databases and verify that the data has been migrated?

  7. signy
    Member
    Posted 3 years ago #

    Hi,

    This is a new install with minimal content.

    The databases I created show, but the tables from the original database did not move into either the "__global" or the "__home" databases that I had created.

    The Shardb link is now gone from the Tools category.

    Should I rerun the tool. If so, how?

    Thanks.

  8. Ron Rennick
    MultiSite Guru
    Posted 3 years ago #

    The migration tool is in shardb-admin.php so reinstall that file. The migration tool only works if you have db-settings configured correctly.

  9. signy
    Member
    Posted 3 years ago #

    All resolved.

    The "Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:3306 (Connection refused)" messages were happening because mySQL is not set to listen on any port by default on my host's servers.

    The db.php file apparently referenced localhost:3306. My hosting company commented out the "skip-networking" line in the my.cnf file to allow mysql to listen on that port (3306).

    This allowed me to upload the db.php file without the error messages showing up.

    Many thanks for your help.

  10. Ron Rennick
    MultiSite Guru
    Posted 3 years ago #

    Glad you got it sorted out.

    Can you mark the thread as resolved?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags