This Advice May Help You If Your Drupal 7 Has Started To Run Slowly

28 May · by Tim Kamanin · 2 min read

Just wanted to make a quick share on how to solve one weird Drupal 7 performance related problem. Picture this. Yesterday, your Drupal 7 site run pretty ok, but today it as slow as a snail and you don't remember yourself changing anything. I myself encountered this problem today and spend a good hour looking for a problem source. My problem was connected to a so-called "Avoid re-scanning module directory when multiple modules are missing" bug which is still not resolved. This problem happens if you have some missing modules in your Drupal installation. For example, you could delete or rename module while it's enabled (which happens often on a development machine).

The Solution

Go to your phpmyadmin and run this query:

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

You will get a list of all enabled modules. Now verify if you don't have any missing modules in this list. If some modules are missing in your file system do either:

  1. bring the module back and then disable it in your modules list, uninstalling after this. ( The best and safe practice.)
  2. delete corresponding row in the 'system' table. ( Do this with caution and only when you can 't bring the module back, for example, when you develop a module and just renamed it, but forgot to disable it.)
  3. and the most elegant way, but, unfortunatelly, it works if you're on Linux and have Drush installed, type this in your Drupal root folder:
for FN in `drush --extra=--skip-column-names sql-query "SELECT filename FROM system WHERE status = 1"`; do [ ! -f $FN ] && echo "Missing $FN"; done

Credits to a reader with a nickname _lyricnz_ for this tip.

NOTE: Always backup your db before doing any moves!. I hope this advice will help someone.

Want to get more 🔥 tips like this one?

Subscribe to get notified about new dev tutorials

Comments