2

My Drush alias file is:

$aliases['mysite'] = array (
  'uri' => 'mysite.com',
  'root' => '/var/www/mysite',
  'path-aliases' => array(
    '%dump-dir' => '/tmp',
  ),
);

when I do drush @mysite status I get

 Drupal version         :  7.36                                          
 Site URI               :  mysite.com                    
 Database driver        :  mysql                                         
 Database hostname      :  localhost                                 
 Database port          :  3306                                          
 Database username      :  dbuser                                         
 Database name          :  dbname                                         
 PHP executable         :  /bin/php                                      
 PHP configuration      :  /etc/php.ini                                  
 PHP OS                 :  Linux                                         
 Drush version          :  7.0-dev                                       
 Drush temp directory   :  /tmp                                          
 Drush configuration    :                                                
 Drush alias files      :  /home/deploy/.drush/mysite.aliases.drushrc.php 
 Drupal root            :  /var/www/mysite                          
 Site path              :  sites/default 

But I'm unable to run other Drush commands.

eg:

drush @mysite dd    
You need to specify an alias or run this command within a drupal site.           [error]    
Target 'root' not found.        [error]

OR

drush @mysite cc all
No Drupal site found, only 'drush' cache was cleared.                            [warning]
'all' cache was cleared.                                                         [success]

But drush dd commands works this way:

drush dd @mysite
/var/www/mysite

I tried like that, but this one doesn't work though drush cc all @mysite

Any ideas why is that so, the site is running perfectly.

2

2 Answers 2

0

You're using an unstable version of Drush 7.0-dev according to drush github page. You should install Drush 6.60 or lower and try again.

Or you can also switch to a tagged release of version 7 according to the comment below by @greg_1_anderson:

"7.0-dev" is HEAD of master, which is refreshed almost daily. So, the OP might be using a very recent build, or one that is over a year old. Switching to a tagged build like 7.0-rc1 would remove the uncertainty.

7
  • 1
    For me 7.0-dev is more stable than 6.x, because it's older and has too many bugs. Downgrading is not the solution.
    – kenorb
    Commented Apr 22, 2015 at 10:26
  • 1
    sorry I didn't believe you at first because Drush 7 is working perfectly in Vagrant box which has Ubuntu 14.04 with php 5.5... I am using CentOS locally with PHP 5.5 from Remi repo and Drush7 indeed was the culprit. I degraded it to 6.* and its working perfectly.
    – user12947
    Commented Apr 22, 2015 at 13:36
  • What version of Drush 7 are you using? Drush 7.0-rc1 should be plenty stable, and 7.0-rc2 will be tagged shortly from the head of master. It would be very useful to know why you do not see 'Database : Connected' in drush status when using Drush 7. If you have time to isolate further, please report your results in the Drush issue queue. Commented Apr 22, 2015 at 16:29
  • @greg_1_anderson OP is using 7.0-dev as can be seen in the question
    – Beebee
    Commented Apr 22, 2015 at 18:14
  • 1
    yes, 7.0-rc1 also works fine. I assume I downloaded the version that day which was buggy.... changed back to Drush7.
    – user12947
    Commented May 4, 2015 at 14:00
1

In drush status you should have the following lines right after Database credentials:

Database                        :  Connected
Drupal bootstrap                :  Successful 

When you don't have it, this suggest your Drupal instance is not properly configured and drush has problem bootstrapping it. For example, you may check if you can connect to the database, try: drush @mysite sqlc.

When executing dd on a remote machine, Drupal needs to be able to bootstrap on the configuration level, so it can read the variables. When you don't have the proper access, you'll have the error like:

Target 'root' not found.

See also: drush_core_drupal_directory().


Other suggestions:

  • Make sure that on your local and remote you have got the same version of drush.

  • Other problems could include issues with specific PHP version (see: #779).

  • If you've still problems, run drush with verbose (-v) or debug options (-d).

7
  • Thanks for great tips about the Database and Drupal Bootstrap fields in status. The environment is local only with edited /etc/hosts file.
    – user12947
    Commented Apr 22, 2015 at 12:38
  • Its not PHP version, as I am using php 5.5+
    – user12947
    Commented Apr 22, 2015 at 12:41
  • @JhilkeDai As I've said, you've to configure your database correctly first, so it would say Connected. Check your settings.php if you've the right credentials and your database works as I've said: drush @mysite sqlc. Once you fix the database connection, it should work.
    – kenorb
    Commented Apr 22, 2015 at 12:43
  • the site is working properly from front end. I can click around, log in as admin, clear cache from front-end, anything.... The drush @mysite sqlc gives mysql --user=dbuser --password='mysecretpass' --database=dbname --host=localhost --port=3306
    – user12947
    Commented Apr 22, 2015 at 12:52
  • 1
    Thanks for this. I found that my database settings weren't configured properly in settings.php. Once I fixed that I no longer got this issue.
    – neuquen
    Commented Dec 20, 2017 at 22:00

Your Answer

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