Drupal bootstrap running from command line I am using Drupal 7 functions externally, and I followed this tutorial for using Drupal functions externally; it works perfectly.

In test.php file I have loaded/included Drupal bootstrap. 

When I run the script from command line (php test.php), it gives me the following error:


  PDOException: SQLSTATE[42000] [1049] Unknown database &#039;default_drupal&#039; in lock_may_be_available() (line 167 of /data/var/www/html/mcsu_sites_test01/includes/lock.inc).


How can I fix this error?
You could also try Drush. Once you've installed it, you can cd into your drupal root then run drush scr test.php. In that file, all Drupal functions will be available.