Drush php-script | Drupal functions such as node_load() are not being found I successfully installed Drush on Ubuntu 12.04, and I created a script containing the following line.

print_r(node_load(10));


I am calling the script with drush php-script --uri=http://localhost myscript.php

Drush returns the following error.


  PHP Fatal error: Call to undefined function node_load()


I also tried with drush --uri=http://localhost cache-get, but I get the following error.


  Command cache-get needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.
  The drush command 'cache-get' could not be executed.
  Drush was not able to start (bootstrap) the Drupal database.
  Hint: This may occur when Drush is trying to:  
  
  
  bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See drush topic docs-aliases for details.
  connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.
  Drush was attempting to connect to: 
  Drupal version:  7.26
  Site URI:  http://localhost
  Database driver:  mysql
  Database hostname: 127.0.0.1
  Database username: username // This is shown correctly
  Database name: database_name  // This is shown correctly
  PHP executable: /usr/bin/php
  PHP configuration:  /etc/php5/cli/php.ini 
  PHP OS:  Linux
  Drush version:  7.0-dev
  Drush temp directory:  /tmp
  Drush configuration:
  Drush alias files:
  Drupal root:  /opt/lampp/htdocs
  Site path:  sites/default
I finally figured out what was missing.

In my case I had to install the mysql-client-core-5.5 package with sudo apt-get install mysql-client-core-5.5.