WPIntell

Source evidence

Undefined Variables in db.php

HyperDB · support · 2021-02-08T08:18:00+00:00

complaintsentiment
highseverity
1.0relevance
9replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

6 / 35 rows with source links

17.1% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

29 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
addictedcorp unresolved
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. 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 4 years, 8 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

Comments

9 shown
Tyler Paulson 2021-03-16T19:27:00+00:00

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.

tchsup 2021-06-29T02:40:00+00:00

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

Tyler Paulson 2021-06-29T05:24:00+00:00

@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 ));

Deepak 2021-09-12T14:34:00+00:00

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 .

Tyler Paulson 2021-09-13T16:37:00+00:00

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

Deepak 2021-09-13T19:20:00+00:00

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

Deepak 2021-09-14T06:16:00+00:00

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’; } */

Deepak 2021-09-14T10:35:00+00:00

@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 4 years, 8 months ago by Deepak .

Deepak 2021-10-13T15:21:00+00:00

@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