Undefined function user_load() My Drupal 7 installation works fine, except for drush, which does not.


  $ cd /srv/www/drupal_site
  
  $ drush pm-refresh
  
  PHP Fatal error:  Call to undefined function user_load() in
  /usr/share/php/drush/includes/drupal.inc on line 138
  
  Drush command terminated abnormally due to an unrecoverable error.
  
  Error: Call to undefined function user_load() in
  /usr/share/php/drush/includes/drupal.inc, line 138
  
  Drush was not able to start (bootstrap) Drupal.


This is Drupal 7.24 and drush 5.10.0 from Debian. A couple of modules and themes have been installed from drupal.org but IMHO nothing fancy. Curent versions of drush6 or drush7 refer to a missing drupal_get_profile() function but otherwise don't help.

Any ideas what the cause of this problem is, and/or how to debug this?

EDIT: It works fine, except for these spurious error lines displayed on the web page (even though I do not use any sort of debug mode), as reported by a user:


  Notice: Undefined index: post-load integration files in libraries_load_files() (line 697 of /var/www/drupal7/modules/libraries/libraries.module).


This may or may not be related to my problem.

I tried using Drush 6.x/7.x, but it just returns a different error message.


  Call to undefined function drupal_get_profile() in /usr/share/php/drush/includes/bootstrap.inc on line 963


drush cc hits an error before it can do anything; the same happens with drush rr, which returns a different error, but equally intractable. 

php-apc is not installed; I have Memcached, but killing it didn't change anything.
I did not change any module weights.
We got the same errors here.

After some time we recognized that our database-import (cloning production db to local dev machine) went wrong and the database wasn't populated properly. After fixing the db the errors went away...

So - my hint: check your database structure and data.

BTW: There is a similar question - but with an memcached in the drupal setup