db.php Symlink

John Blackbourn edited this page Jul 17, 2018 · 9 revisions

Query Monitor includes a file called db.php in the wp-content directory of the plugin. When the plugin is activated, this file gets symlinked to the WP_CONTENT_DIR directory. When in place, this file allows Query Monitor to do a few clever things such as logging the query result and full stack trace for all database queries.

When Query Monitor is unable to symlink its db.php file into place

Occasionally PHP won't have the correct permissions to put this symlink in place. Query Monitor will still work fine in this situation, but you won't see extended information that makes Query Monitor much more useful.

You can manually create the symlink by running the following command on the command line:

Linux / OS X:

ln -s /path/to/wordpress/wp-content/plugins/query-monitor/wp-content/db.php /path/to/wordpress/wp-content/db.php

Windows (requires administrator privileges):

mklink C:\path\to\wordpress\wp-content\db.php C:\path\to\wordpress\wp-content\plugins\query-monitor\wp-content\db.php

Alternatively, you can relax the file permissions on the WP_CONTENT_DIR directory and then de-activate and re-activate the plugin and it'll attempt to create the symlink again.

When an existing db.php file is already in place

The db.php file will sometimes conflict with another plugin that also uses a db.php file. Such plugins include:

  • W3 Total Cache
  • LudicrousDB
  • HyperDB

There is nothing that can be done at this time. This a WordPress core limitation due to the fact that the file must be called db.php and placed in the wp-content directory, and only one can exist there.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.