Query Monitor Does Not Show Extended Information Without a Symlink:
The WordPress plugin Query Monitor, when being installed, tries to create a symlink wp-content/db.php
to the file wp-content/plugins/query-monitor/wp-content/db.php
.
If the symlink could not be created, the plugin would not show the extended query information. And you’ll see the messages in the plugin panel:
Extended query information such as the component and affected rows is not available. Query Monitor was unable to symlink its db.php
file into place. See this wiki page for more information.
In this case, it is recommended to create the symlink to db.php manually. But if you can not do this:
How to Show Extended Information Without a Symlink?
Create a file db.php
in the directory wp-content
of your WordPress site (the directory wp-content
is located in the webroot of your WordPress site). Add these lines to the file:
<?php include __DIR__ . '/plugins/query-monitor/wp-content/db.php';
Now, the extended query information will be shown in the plugin panel.
I tested with Query Monitor verion 3.15.0.
Please notice:
- If the file wp-content/db.php already exists, please do not overwrite it. Or it could cause problems.
- All paths in this article are given relative to the webroot directory of your WordPress site. It is also assumed, that the plugin Query Monitor is installed by the default path.
- If you delete the plugin Query Monitor, do not forget to delete the file
db.php
you added manually. - I use this solution in the development environment. If you use it on production, you do it at your own risk.
Why Not Just Create a Symlink to db.php, as Recommended?
Sometimes you can not create the symlink.
For example, if you work on a Windows computer. And, for web development, you run a Linux virtual machine on Oracle VirtualBox. And you have your WordPress site inside a Docker container. And you are using VirtualBox Guest Additions to share your local WordPress folder to this virtual machine. In this case, you would be unable to create the symlink. Even manually. Even under Linux root.
If you run the command in the WordPress webroot directory inside the Docker container:
ln -s ./wp-content/plugins/query-monitor/wp-content/db.php ./wp-content/db.php
, the operation will fail:
ln: failed to create symbolic link ‘./wp-content/db.php’: Operation not permitted
So sometimes you can not create a symbolic link. And you need a workaround.
Why Can Not I Just Copy the File db.php to the Directory wp-content?
If you copy the file wp-content/plugins/query-monitor/wp-content/db.php
to the directory wp-content
, you’ll see this message in the plugin panel:
Extended query information such as the component and affected rows is not available. A conflicting db.php
file is present. See this wiki page for more information.
So copying the file would not solve the problem.
Please see the plugin author’s explanation for why the file wp-content/plugins/query-monitor/wp-content/db.php
can not be simply copied to the directory wp-content
.
In short, this could overwrite db.php
created by some other plugin there. Such a plugin as:
- W3 Total Cache
- LudicrousDB
- HyperDB
(source)