How to manually disable modules in Drupal 7

I run into an issue recently when I installed OpenCivic and supporting modules for Drupal 7, I got a screen that was telling me that there was a problem with a module, when I was accessing the site.

I was not sure which module that I installed caused the issue, and I could not access the module admin, so I had to do it manually.  So what did I do, first I took a backup, do a mysqldump (or export) of your Drupal db to a local file in case things go wrong and you need to roll back.

Using phpMyAdmin I accessed the database for Drupal. I then looked for the “system” table. I then click and open the “system” table, did a search to find the record for the module that is causing the problems and selected the edit function to change the status to “0” and then saved it.

This can also be done from the MySQL command line

To disable a module using the MySQL command line, run the following SELECT to look at the state of your data before the change. This will help you to find the full name of the module too.

MySQL Commands

See all the modules enabled:

SELECT name,status FROM system WHERE type='module' AND status='1';

See if a particular module is enabled:

SELECT name,status FROM system WHERE name='module_name';

Disable your module, set the status to 0 for the module name that you want to disable.

UPDATE system SET status='0' WHERE name='module_name';

Enable your module:

UPDATE system SET status='1' WHERE name='module_name';

Disable non core modules

UPDATE `system`
SET `status`= '0'
WHERE `filename` LIKE '%sites/all%'
AND `type` = 'module'
AND `status` = '1'

Uninstall a module so that it will not appear on admin/modules/uninstall page

UPDATE system SET status='0', schema_version='-1' WHERE name='module_name';

Clear Cached System List.

The cached copy of the system list is in the cache_bootstrap table. Clear the cached copy of the system list, locate the “cache_bootstrap” table, and delete the record with cid=”system_list”. To update the cache using the mysql command line, type:

DELETE FROM cache_bootstrap WHERE cid='system_list';

Comments

One response to “How to manually disable modules in Drupal 7”

  1. Yollix Avatar
    Yollix

    Working like a charm.. Thanks for the useful guide!!

Leave a Reply

Your email address will not be published. Required fields are marked *