How to do menu rebuild when having PHP Fatal error? I have been trying to get the command menu_rebuild(); to work on drush. However, I keep getting this error:



I, of course, think I installed Drush correctly. However, I can't be 100% certain since I've never used Drush before.

The reason why I am trying to run this command is because my admin menu is giving me problems. Whenever I install new modules, the settings pages corresponding to those modules are missing. Yet, they are installed and working according to Drupal.
Make sure you're running drush in your web root and drush status is showing Drupal bootstrap: Successful.

Then try the following steps:


drush cc all to clear the caches or clear cache tables manually, e.g.:

echo "SHOW TABLES LIKE 'cache%'" | $(drush sql-connect) | tail -n +2 | xargs -L1 -I% echo "DELETE FROM %;" | $(drush sql-connect) -v

try rebuild menu again: drush eval 'menu_rebuild();'
try rebuild your Drupal registry via:

drush -y dl registry_rebuild
drush rr

consider disabling caches




In case your drush status doesn't show Drupal bootstrap as Successful, you either running it outside of your Drupal webroot or your db credentials are not configured properly in settings.php, or you've some missing/corrupted files which prevents from bootstrapping your Drupal core. 

If you're using multisite, then don't forget to specify your profile by either running inside sites/X dir or make sure you're specifying the right --uri parameter, e.g.: drush -l http://myprofile status (see: drush topic core-global-options for proper syntax).

If you still having the issue, try: drush -vd status to troubleshoot the source of your problem.