Title: Error message when using Database caching with 2nd database
Last modified: April 2, 2020

---

# Error message when using Database caching with 2nd database

 *  Resolved [jackstron](https://wordpress.org/support/users/jackstron/)
 * (@jackstron)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/error-message-when-using-database-caching-with-2nd-database/)
 * I am using a 2nd database in the same MySQL server running the latest WP 5.4,
   latest MYSQL, and latest W3 Cache on Ubuntu 18. I am saving to this database 
   logs which I want to keep separate from my primary WordPress installation. I 
   am using the WP syntax to access another database. However, when using 2nd database
   with activated caching, I get this:
 * Attempt to create object of class W3TC\Exception has been made, but file /var/
   www/myroot/htdocs/wp-content/plugins/w3-total-cache/Exception.php doesnt exists#
   0 w3tc_class_autoload(W3TC\Exception) #1 spl_autoload_call(W3TC\Exception) called
   at [/var/www/myroot/htdocs/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.
   php:25] #2 W3TC\DbCache_WpdbNew->__construct(admin, ‘PASSWORD’, logging, localhost)
   called at [/var/www/myroot/htdocs/wp-content/themes/polly/inc/theme-settings.
   php:146] #3 require_once(/var/www/myroot/htdocs/wp-content/themes/polly/inc/theme-
   settings.php) called at [/var/www/myroot/htdocs/wp-content/themes/polly/functions.
   php:37] #4 include(/var/www/myroot/htdocs/wp-content/themes/polly/functions.php)
   called at [/var/www/myroot/htdocs/wp-settings.php:497] #5 require_once(/var/www/
   myroot/htdocs/wp-settings.php) called at [/var/www/myroot/htdocs/wp-config.php:
   135] #6 require_once(/var/www/myroot/htdocs/wp-config.php) called at [/var/www/
   myroot/htdocs/wp-load.php:37] #7 require_once(/var/www/myroot/htdocs/wp-load.
   php) called at [/var/www/myroot/htdocs/wp-blog-header.php:13] #8 require(/var/
   www/myroot/htdocs/wp-blog-header.php) called at [/var/www/myroot/htdocs/index.
   php:17]
    Fatal error: Uncaught Error: Class ‘W3TC\Exception’ not found in /var/
   www/myroot/htdocs/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.php:25 Stack
   trace: #0 /var/www/myroot/htdocs/wp-content/themes/polly/inc/theme-settings.php(
   146): W3TC\DbCache_WpdbNew->__construct(‘admin’, ‘PASSWORD’, ‘logging’, ‘localhost’)#
   1 /var/www/myroot/htdocs/wp-content/themes/polly/functions.php(37): require_once(‘/
   var/www/myroot…’) #2 /var/www/myroot/htdocs/wp-settings.php(497): include(‘/var/
   www/myroot…’) #3 /var/www/myroot/htdocs/wp-config.php(135): require_once(‘/var/
   www/myroot…’) #4 /var/www/myroot/htdocs/wp-load.php(37): require_once(‘/var/www/
   myroot…’) #5 /var/www/myroot/htdocs/wp-blog-header.php(13): require_once(‘/var/
   www/myroot…’) #6 /var/www/myroot/htdocs/index.php(17): require(‘/var/www/myroot…’)#
   7 {main} thrown in /var/www/myroot/htdocs/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.
   php on line 25
 * Looks like a problem which has not been predicted by developers…?
    -  This topic was modified 6 years, 2 months ago by [jackstron](https://wordpress.org/support/users/jackstron/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/error-message-when-using-database-caching-with-2nd-database/#post-12621446)
 * Hello [@jackstron](https://wordpress.org/support/users/jackstron/)
 * I am sorry about the issue you are experiencing and I am happy to assist you 
   with this.
    We are checking this and will reply as soon as we replicate the issue
   and investigate. Thank you!
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/error-message-when-using-database-caching-with-2nd-database/#post-12623667)
 * Hello [@jackstron](https://wordpress.org/support/users/jackstron/)
    Thank you
   for your patience. Can you please change to following: In /wp-content/plugins/
   w3-total-cache/DbCache_WpDbNew.php
 * replaceon line 25:
    `throw new Exception( 'called incorrectly, use instance()');`
   with `throw new \Exception( 'called incorrectly, use instance()' );`
 * Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Error message when using Database caching with 2nd database’ is closed
to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/error-message-when-using-database-caching-with-2nd-database/#post-12623667)
 * Status: resolved