3

I installed Drush and then I installed Drupal using the regular installer/method.

When I type drush cc all on my terminal I get this message:

No Drupal site found, only 'drush' cache was cleared.

2 Answers 2

9

No, you do not need to install Drupal using Drush in order to use Drush. All you need is to make sure that while running drush cc all, you are in the Drupal directory.

For example, if your Drupal lies under /var/www/Projects with root name as drupal then first you need to move inside /var/www/Projects/drupal and then run the drush cc all command.

The reason being, Drush can be executed inside a Drupal environment only.

2
  • 1
    Technically Drush can be executed outside of a Drupal environment. Most commands such as enabling module and clearing site cache need to be in Drupal environment. Though "drush cc drush" will clear the drush cache no matter where you are. This needs to be done if you downloaded a new drush extension. Also "drush dl" can be run anywhere, for instance to download Drupal itself.
    – tedbow
    May 27, 2014 at 11:31
  • right, for anything you need to make database connection for example enabling a drupal module, you have to run it with in drupal env.
    – arpitr
    May 27, 2014 at 13:31
1

No, drush is independent of each drupal install. But you need to run the command from within the project root, or using a drush alias.

To test if drush is picking up your site properly, you can run

drush st

This will output information about your site, or will let you know if you are not within a site.

If you are connected, you should see database information like this:

 Database username               :  root                                              
 Database name                   :  mydatebasename                                      
 Drupal bootstrap                :  Successful   

Then your cache clear will work with

drush cc all

If you run

drush st

from outside of a drupal project, it will not show the database information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.