WordPress URL Settings Do Not Match Warning when db-error.php File is Present

Local was showing the following warning on some of my sites each time I started them:

Warning! This site’s WordPress URL settings do not match the host set in Local.

In these cases the sites actually were working. In most cases I could click the Fix It button, and nothing would seem to change after it provisions the site. But for a network local site, it would actually break the site. Looking at wp-config.php I’d notice that the define( 'DOMAIN_CURRENT_SITE', ’site.local' ); line no longer had the domain in it, but what seemed like the content of an entire HTML page. I could replace that with the domain and the site would work again, until I restarted it and Local again presented the warning, which if “fixed” would actually break the site again in the same way.

Eventually I copied the HTML content instead of just deleting it, and pasted it into a new file to view in a web browser. Doing this I realized that the content was actually that of the db-error.php file this site had from copying the wp-content folder as a whole from the live website this local is built from (this file is an advanced plugin file you put at the root of the content directory to customize the DB error message shown to visitors). Once I deleted this file from my local site the warning went away completely.

So, it seems that there is a bug in Local that treats the presence of the db-error.php file as a warning about the URL settings not matching, and further when it tries to “fix” the nonexistent problem it copies that file’s content into the DOMAIN_CURRENT_SITE define statement in wp-config.php if that is present, as it is for network sites, rather than putting the domain there. This is a severe bug, if an uncommon one, because what says will fix the local site in truth breaks the local site. I just wanted to bring this up as a bug report, as it is something that should be fixed.

Hi Alexander,

Thanks for the fantastic bug report! We’ll be looking into this ASAP.


I just attempted to reproduce this with a simple db-error.php file but was unable to do so.

Oddly enough, I did notice that after clicking on the Fix It button, it would fix the URL in the wp-config.php file but then go back to the incorrect URL.

With that said, while I can’t seem to replicate the issue at this time, we can look into sanitizing and validating the URL returned from WP-CLI before performing any actions with it.

Here is a copy of the actual db-error.php that is used for this site, just with the actual organization’s name removed. But it seems, if you think that this is a sanity checking issue with what the WP CLI returns, this may end up being a bug in WP itself, or its CLI, and not Local.

I am getting the same error. I am not an experienced developer, so I don’t understand the details of this thread. My BackWPup backups also don’t work with InstantWP.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.