• Resolved pawan19

    (@pawan19)


    Dear Support Team,

    We have recently started using the W3 Total Cache plugin and are planning to leverage it for multiple purposes, including:

    1. Caching using Redis (on AWS)
    2. Image serving using CDN and S3
    3. Potentially exploring minification in the future (though this is not a current priority).

    During our testing, we encountered an issue when using the following configuration in wp-config.php:

    define('W3TC_CONFIG_DATABASE', true);

    We are experiencing database connection request timeouts in the Apache error log and it makes Instances unhealthy. Additionally, we sometimes see errors such as:

    [Thu May 30 21:54:17.642465 2024] [php:error] [pid 31218] [client 192.168.56.208:46768] PHP Fatal error: Uncaught TypeError: mysqli_num_fields(): Argument #1 ($result) must be of type mysqli_result, bool given in /var/www/html/wp-includes/class-wpdb.php:3819
    Stack trace:
    #0 /var/www/html/wp-includes/class-wpdb.php(3819): mysqli_num_fields()
    #1 /var/www/html/wp-includes/class-wpdb.php(786): wpdb->load_col_info()
    #2 /var/www/html/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php(218): wpdb->__get()
    #3 /var/www/html/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.php(122): W3TC\DbCache_WpdbInjection_QueryCaching->query()
    #4 /var/www/html/wp-includes/class-wpdb.php(3099): W3TC\DbCache_WpdbNew->query()
    #5 /var/www/html/wp-content/plugins/wordfence/lib/wfConfig.php(292): wpdb->get_results()
    #6 /var/www/html/wp-content/plugins/wordfence/lib/wfConfig.php(369): wfConfig::loadAllOptions()
    #7 /var/www/html/wp-content/plugins/wordfence/lib/wfConfig.php(529): wfConfig::hasCachedOption()
    #8 /var/www/html/wp-content/plugins/wordfence/lib/wfCredentialsController.php(12): wfConfig::get()
    #9 /var/www/html/wp-content/plugins/wordfence/lib/wfCredentialsController.php(16): wfCredentialsController::allowLegacy2FA()
    #10 /var/www/html/wp-content/plugins/wordfence/lib/wordfenceClass.php(48): wfCredentialsController::useLegacy2FA()
    #11 /var/www/html/wp-content/plugins/wordfence/wordfence.php(118): require_once('/var/www/html/w…')
    #12 /var/www/html/wp-settings.php(453): include_once('/var/www/html/w…')
    #13 /var/www/html/wp-config.php(108): require_once('/var/www/html/w…')
    #14 /var/www/html/wp-load.php(50): require_once('/var/www/html/w…')
    #15 /var/www/html/healthcheck.php(2): require('/var/www/html/w…')
    #16 {main}
    thrown in /var/www/html/wp-includes/class-wpdb.php on line 3819

    We are currently in the UAT stage and plan to move to production soon. Our instances are part of an autoscaling group, which includes multiple instances.

    Could you please help us understand if there is any alternative way to save our settings in the database rather than on the server?
    This seems necessary for the configurations to be replicated across new instances scaled by Autoscaling. When we set define('W3TC_CONFIG_DATABASE', false);, we do not encounter any issues, but without setting it to true, our configurations do not save in the database and fail to replicate to new servers.

    Thank you for your assistance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @pawan19

    Thank you for reaching out and I am happy to help!
    Just to confirm, you’ve checked out our wiki page for this?

    Also, can you please sahre if you are using DB caching and which Caching method is selected for this this feature?

    Thanks!

    Thread Starter pawan19

    (@pawan19)

    Hi @vmarko
    Thank you so much for the Prompt reply.

    I just got the chance to read the wiki you shared above, I think we need to enable that DB option in wp-config file. As I explained during my question we will have multiple servers and Since there is Scaling, Instances will keep on scaling up and down as required.

    And, yes we are using DB caching with AWS Managed Redis (Elastic Cache).

    Just for your information our site is : https://www.homeloanexperts.com.au/

    Please feel free to suggest a better setup how you feel is good for this website.

    Thank you,

    • This reply was modified 6 months ago by pawan19.
    • This reply was modified 6 months ago by pawan19.
    Thread Starter pawan19

    (@pawan19)

    Hi @vmarko
    I recently received a email from Developers regarding one more error:

    TypeError: mysqli_num_fields(): Argument #1 ($result) must be of type mysqli_result, bool given File "/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php", line 218, in W3TC\DbCache_WpdbInjection_QueryCaching::query 'col_info' => $this->wpdb_mixin->col_info, File "/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.php", line 122, in W3TC\DbCache_WpdbNew::query return $this->active_processor->query( $query ); File "/wp-content/plugins/wordpress-seo/lib/orm.php", line 287, in Yoast\WP\Lib\ORM::execute $result = $wpdb->query( $query ); File "/wp-content/plugins/wordpress-seo/lib/orm.php", line 1954, in Yoast\WP\Lib\ORM::run $success = self::execute( $query, $this->values ); File "/wp-content/plugins/wordpress-seo/lib/orm.php", line 385, in Yoast\WP\Lib\ORM::find_one $rows = $this->run(); ... (14 additional frame(s) were not displayed)

    P.S: We have received this from Sentry .

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @pawan19

    Thank you for your feedback.
    Let me check and investigate this more and I’ll get back to you with more information on this.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.