Fix W3 Total Cache Failed to Open Dir /cache/db/option_comments Error

»»»Fix W3 Total Cache Failed to Open Dir /cache/db/option_comments Error

For WordPress website installed with W3 Total Cache (W3TC) plugin which intends to optimize and speed up the delivery of dynamic content to visitors, there may be occasional occurrences of PHP error such as the following:

warning: opendir (home/techjourney/public_html/wp-content/cache/db/options_comments/): failed to open dir: No such file or directory

When W3 Total Cache plugin is disabled, the issue is resolved.

W3 Total Cache PHP Error

The error is even more prominent and clearly visible if Query Monitor debugging plugin is installed to monitor the database queries, hooks, conditionals and overall performance of the WordPress powered site. In Query Monitor, all call stacks indicate that the error is likely caused by W3 Total Cache plugin, with Util_File.php and/or Cache_File.php the likely culprits.

The issue happens when Database Cache is enabled, and the Database Cache Method is set to Disk. W3TC’s Database Cache attempts to reduce post, page and feed creation time by caching database objects in order to decrease the response time of the site. However, when the Database Cache is set to store on disk filesystem, the options_comments directory does not exist, hence PHP is logging the error.

The missing options_comments directory does not affect the functionality of W3 Total Cache, but if you don’t want to see any error message and want to fix the error, try to change the setting in Performance -> General Settings based on one of the following methods:

  • Change the Database Cache Method to non-disk method, such as Opcode: Alternative PHP Cache (APC / APCu), Opcode: eAccelerator, Opcode: XCache, Opcode: WinCache, Memcached or Redis.
  • Disable the Database Cache by unchecking the Enable check box.

By |2017-05-04T23:26:01+00:00May 4th, 2017|Categories: Web Publishing|Tags: , |0 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years. Connect with LK through Tech Journey on Facebook, Twitter or Google+.