Manually Disable a Drupal Module

Posted onFriday, 26 June 2009

Tagged withsyntaxhighlighterDrupal

A situation can arise where you've enabled a module through Administer > Modules (Drupal 4.7 and below) or Administer > Site building > Modules (Drupal 5.x and above), but then because of a fatal error of some kind cannot get back to the modules administration screen to disable it (sometimes you cannot access any pages of your site at all) -- only the error is displayed and nothing else.

This can be resolved by executing the following query in the database (replace module_name with the name of the module you are trying to disable):

UPDATE `system` SET `status` = '0' WHERE `name` = 'module_name' LIMIT 1;

This will disable the module so that you can access your administration panel again. The module name is the filename (without extension) of the .module file. For example, views is the module name for /sites/all/modules/views.module.

Do not delete the module from the file-system before disabling (and optionally uninstalling it) via the instructions above or through the administration interface. Doing so might leave tables and other objects orphaned, and prevents the module from properly cleaning up after itself.