• Hi,
    I have tried everthing i found but nothing helped. After setting up everthing i always get the following errors:
    Notice: Undefined variable: write in /wp-content/db.php on line 559

    Notice: Undefined variable: write in /wp-content/db.php on line 596

    Notice: compact(): Undefined variable: read in /wp-content/db.php on line 685

    Notice: compact(): Undefined variable: write in /wp-content/db.php on line 685

    Maybe someone can help me out with a solution. I′m losing my hope.

Viewing 9 replies - 1 through 9 (of 9 total)
  • I just came across this, specifically the line 685 issue.

    I updated my configuration function to explicitly include the value for the write parameter even though I’m using the default and that seemed to fix the issue for me.

    @tp22 Can you please explain how you did that? Perhaps post the code used here?
    Thank you!

    @tchsup Here’s an example of explicitly defining the read and write values even though they are the defaults:

    
    $wpdb->add_database(array(
    	'host'     => DB_HOST,     // If port is other than 3306, use host:port.
    	'user'     => DB_USER,
    	'password' => DB_PASSWORD,
    	'name'     => DB_NAME,
    	'read'     => 1,
    	'write'    => 1
    ));
    

    hi , im using wp 5.7.2 and getting criticalk error in my sit e, may i know is this works with the latest versions , and i would like to know what version you are using .

    @deepakdcc I’m currently using HyperDB on a site running 5.7.2. Could you share the critical error you’re getting?

    hi , I deleted the site, ill recreate it and send you errors very soon,
    btw it just showing wp default critical error page , not specifically mentioning others

    it shows a critical error, here is my configuration but I have no idea how to make partitioning work on a round-robin basis for multiple databases. can you help me with this?
    for example, i run a multisite network with version 5.7.2, and have 100+ databases and want to partitions the datas like when a new blog is created it should automatically sit in a database and the next blog in the next database and so on . or any suggestions for better performance since in run woocommerce in it which is resource-intensive

    $wpdb->add_database(array(
    ‘host’ => ‘localhost’,
    ‘user’ => ‘new user’,
    ‘password’ => ‘password’,
    ‘name’ => ‘new database’,
    ));
    $wpdb->add_database(array(
    ‘host’ => ‘localhost’,
    ‘user’ => ‘newuser’,
    ‘password’ => ‘password’,
    ‘name’ => ‘new database’,
    ‘dataset’ => ‘set1’,
    ));
    $wpdb->add_callback(‘my_db_callback’);
    function my_db_callback($query, $wpdb) {
    // Multisite blog tables are “{$base_prefix}{$blog_id}_*”
    if ( preg_match(“/^{$wpdb->base_prefix}\d+_/i”, $wpdb->table) )
    return ‘set1’;
    }
    */

    @tp22
    it shows a critical error, here is my configuration but I have no idea how to make partitioning work on a round-robin basis for multiple databases. can you help me with this?
    for example, I run a multisite network with version 5.7.2, and have 100+ databases and want to partitions the data like when a new blog is created it should automatically sit in a database and the next blog in the next database and so on . or any suggestions for better performance since in run woocommerce in it which is resource-intensive

    $wpdb->add_database(array(
    ‘host’ => ‘localhost’,
    ‘user’ => ‘new user’,
    ‘password’ => ‘password’,
    ‘name’ => ‘new database’,
    ));
    $wpdb->add_database(array(
    ‘host’ => ‘localhost’,
    ‘user’ => ‘newuser’,
    ‘password’ => ‘password’,
    ‘name’ => ‘new database’,
    ‘dataset’ => ‘set1’,
    ));
    $wpdb->add_callback(‘my_db_callback’);
    function my_db_callback($query, $wpdb) {
    // Multisite blog tables are “{$base_prefix}{$blog_id}_*”
    if ( preg_match(“/^{$wpdb->base_prefix}\d+_/i”, $wpdb->table) )
    return ‘set1’;
    }
    */`

    • This reply was modified 3 years, 6 months ago by Deepak.

    @tp22 hi, i wrote you in mail for this, please let me know if you can help me in this , i can pay for this

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Undefined Variables in db.php’ is closed to new replies.