2

Apologies for the length of this post. I have a Drupal install where the drupal files (and all content) is on one server, and the database is on another. The site itself is working fine, and all admin tasks are possible from the admin UI.

However, when I try to execute any commands using Drush, I get output similar to the below.

command used: drush up --debug

Output:

Starting Drush preflight. [0.04 sec, 4.13 MB]                        [preflight]
Cache HIT cid: 7.0.0-commandfiles-0-7b327cc676585aaed226364ef9373982     [debug]
[0.07 sec, 4.22 MB]
Bootstrap to phase 0. [0.34 sec, 10.28 MB]                           [bootstrap]
Bootstrap to phase 6. [0.34 sec, 10.29 MB]                           [bootstrap]
Drush bootstrap phase : bootstrap_drupal_root() [0.35 sec, 10.86 MB] [bootstrap]
Initialized Drupal 7.34 root directory at                               [notice]
/users/castaff/dfitzpat/public_html [0.37 sec, 10.86 MB]
Find command files for phase 1 (max=6) [0.37 sec, 8.49 MB]               [debug]
Cache HIT cid: 7.0.0-commandfiles-1-3ca83829a6f5d5a7b3d70d3f4652b7de     [debug]
[0.37 sec, 8.5 MB]
Drush bootstrap phase : bootstrap_drupal_site() [0.38 sec, 8.51 MB]  [bootstrap]
Initialized Drupal site default at sites/default [0.38 sec, 8.51 MB]    [notice]
Find command files for phase 2 (max=6) [0.39 sec, 8.51 MB]               [debug]
Cache HIT cid: 7.0.0-commandfiles-2-f17fc6bdab2f74278df75194ca483893     [debug]
[0.39 sec, 8.51 MB]
Drush bootstrap phase : bootstrap_drupal_configuration() [0.4 sec,   [bootstrap]
8.58 MB]
Find command files for phase 3 (max=6) [0.4 sec, 8.59 MB]                [debug]
PDO support is required. [0.41 sec, 8.75 MB]                         [bootstrap]
Bootstrap to phase 5. [0.41 sec, 8.75 MB]                            [bootstrap]
Command pm-update needs a higher bootstrap level to run - you will   [error]
need to invoke drush from a more functional Drupal environment to run
this command. [0.41 sec, 8.75 MB]
The drush command 'up' could not be executed. [0.41 sec, 8.75 MB]    [error]
Drush was not able to start (bootstrap) the Drupal database.         [error]
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.34                                     
 Site URI               :  http://default                           
 Database driver        :  mysql                                    
 Database hostname      :  localhost                                
 Database port          :                                           
 Database username      :  db_user                                    
 Database name          :  [db_name]                                 
 PHP executable         :  /usr/bin/php                             
 PHP configuration      :  /etc/php5/cli/php.ini                    
 PHP OS                 :  Linux                                    
 Drush script           :  /users/castaff/dfitzpat/.composer/vendor 
                           /drush/drush/drush.php                   
 Drush version          :  7.0.0                                    
 Drush temp directory   :  /tmp                                     
 Drush configuration    :                                           
 Drush alias files      :                                           
 Drupal root            :  /users/castaff/dfitzpat/public_html      
 Site path              :  sites/default                            

 [0.57 sec, 11.43 MB]

Intrestingly, the command:

drush sql-cli connects fine.

If anyone can shed light I'd be most grateful. I've tried:

  1. replacing localhost with 127.0.0.1;
  2. Replacing with the exact ip of the server on which the database is located.

I'd like to find out where this is failing and then (obviously) how to fix it.

Many thanks.

1 Answer 1

1

Best solution for me is using Xdebug.

Here is a great article for configuring it with PHPstorm

https://www.lullabot.com/blog/article/debugging-drush-commands-xdebug-and-phpstorm

Your Answer

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

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