Replies: 1
Dear Support Team,
We have recently started using the W3 Total Cache plugin and are planning to leverage it for multiple purposes, including:
- Caching using Redis (on AWS)
- Image serving using CDN and S3
- 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.