Run php script after drupal bootstraps with Drush

Public

You can run any php script after the drupal bootstraps complete.

Get raw version
php
  1. drush scr /path/to/php-script.php
  2.  
  3. //or
  4.  
  5. drush php-script /path/to/php-script.php
  6.  
  7. //or alternatively create a testing.php file in drupal root and paste the code
  8.  
  9. <?php
  10. define('DRUPAL_ROOT', getcwd());
  11.  
  12. require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  13. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  14.  
  15. // here add your code.