drupal 7 error: table blocked_ips not found I have a running Drupal 7 site and wanted to restore it locally on development computer. But on localhost I keep receiving white screen in Firefox or Internal Server Error code 500 on Chrome.

Debugging shows that Drupal is running line 1895 of bootstrap.inc, which says:

$denied = (bool)db_query("SELECT 1 FROM {blocked_ips} WHERE ip = :ip", array(':ip' =&gt; $ip))-&gt;fetchField();


And just after this line it jumps to error handler, complaining about missing blocked_ips table. The blocked_ips table is not there on either site, the production site had no problem with it.

How to deal with this?
The blocked_ips table is created unconditionally by the system module...it should be there in any standard D7 install.

The process goes like this:


drupal_boostrap() calls drupal_bootstrap_page_cache() when in the DRUPAL_BOOTSTRAP_PAGE_CACHE bootstrap phase.
drupal_bootstrap_page_cache() calls drupal_block_denied()
drupal_block_denied() calls drupal_is_denied()
drupal_is_denied() contains the following line of code:

$denied = (bool) db_query("SELECT 1 FROM {blocked_ips} WHERE ip = :ip", array(':ip' =&gt; $ip))-&gt;fetchField();



So Drupal is expecting that table to exist. The only caveat is that if you have a variable called blocked_ips in the variable table the value from there will be used instead of the database being queried. Maybe you have that variable on the local version, and not on the live, and the issue is being masked by that fact?

If you didn't have any data in that table then it would be safe to copy the schema from an empty Drupal install and just create the table.

However, it might be worth checking the integrity of the rest of your data as it sounds like something's gone wrong either on your local copy or during the migration.