user_load() and EntityFieldQuery not found when running script via Drush I'm trying to run a php script from the command line via Drush. When I tried to use EntityFieldQuery...

$query = new EntityFieldQuery;


I got the error:

PHP Fatal error:  Class 'EntityFieldQuery' not found in /path/to/my/script.php on line 43


So, I tried to make it even simpler, and just used this script:

&lt;?php

print "inside script\n\n";
$user = user_load(1);
print "name: ".$user-&gt;name;

?&gt;


But I get the error:

PHP Fatal error:  Call to undefined function user_load() in /path/to/my/script.php on line 17


It doesn't appear that drush is bootstrapping properly. Am I missing something? What do I need to do for drush to be able to use the drupal apis? 

I read through Drush php-script | Drupal functions such as node_load() are not being found, but I've got mysql client libraries already installed so that isn't a solution for me.
Ok, WOW, I found the error by running my script with the -d option:

drush -d scr /path/to/my/script.php


I noticed in the log it spewed out that it was getting an error connecting to the database. I apparently had messed up the privs when I set them up. I regranted the privs and my script ran just fine. 

The error message about not being able to find a function was a total red herring.