2

Drush on work machine doesn't seem to work at all for me.

Executing drush up returns:

Command pm-update needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.                                                                             [error]
Command pm-update needs the following modules installed/enabled to run: update.                                                                                                                                                    [error]
The drush command 'up' could not be executed.                                                                                                                                                                                      [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.23
  Site URI          : http://default
  Database driver   : mysql
  Database hostname : localhost
  Database username : root
  Database name     : drupal
  Default theme     : garland
  Administration theme: garland
  PHP configuration : /opt/local/etc/php5/php.ini
  Drush version     : 5.9
  Drush configuration:
  Drupal root       : /Library/WebServer/Documents/drupal
  Site path         : sites/default
  Modules path      : sites/all/modules
  Themes path       : sites/all/themes
  File directory path: sites/default/files
  %paths            : Array

and executing drush cc all returns success too fast, as if it's being executed out side a project directory, without making any effect (no cache clearance).

I've been searching and looking all over the web with no answer to my problem. Please don't tell me to execute the command from my project directory, because I already am. the settings file is in the sites/default.

Tip: I copied the entire site to my laptop, and executed the same commands, and all worked perfectly, it's only my work machine. Could there be any mistaken drush setup? Though, I replicated the same setup on both machines, drush directory in my home directory, with exactly the same permissions, and drush alias installed in the ~/.profile as it is where I put all my bash profile scripts.

Edit 1:

Drupal directory where I execute drush command:

total 496
drwxr-xr-x@ 31 mmss  wheel   1.0K May  4 21:24 .
drwxr-xr-x  48 mmss  wheel   1.6K May  1 12:49 ..
-rw-r--r--@  1 mmss  wheel    12K Jan 20 18:42 .DS_Store
drwxr-xr-x  15 mmss  wheel   510B May  4 21:24 .git
-rw-r--r--@  1 mmss  wheel   104B Oct 21  2013 .gitignore
-rw-r--r--@  1 mmss  wheel   5.6K Aug  8  2013 .htaccess
-rw-r--r--@  1 mmss  wheel    80K Aug  8  2013 CHANGELOG.txt
-rw-r--r--@  1 mmss  wheel   1.4K Aug  8  2013 COPYRIGHT.txt
-rw-r--r--@  1 mmss  wheel   1.4K Aug  8  2013 INSTALL.mysql.txt
-rw-r--r--@  1 mmss  wheel   1.8K Aug  8  2013 INSTALL.pgsql.txt
-rw-r--r--@  1 mmss  wheel   1.3K Aug  8  2013 INSTALL.sqlite.txt
-rw-r--r--@  1 mmss  wheel    17K Aug  8  2013 INSTALL.txt
-rw-r--r--@  1 mmss  wheel    18K Sep 18  2011 LICENSE.txt
-rw-r--r--@  1 mmss  wheel   8.0K Aug  8  2013 MAINTAINERS.txt
-rw-r--r--@  1 mmss  wheel   5.3K Aug  8  2013 README.txt
-rw-r--r--@  1 mmss  wheel   9.4K Aug  8  2013 UPGRADE.txt
-rw-r--r--@  1 mmss  wheel   6.4K Aug  8  2013 authorize.php
-rw-r--r--@  1 mmss  wheel   720B Aug  8  2013 cron.php
drwxr-xr-x@ 49 mmss  wheel   1.6K Aug  8  2013 includes
-rw-r--r--@  1 mmss  wheel   529B Aug  8  2013 index.php
-rw-r--r--@  1 mmss  wheel   703B Aug  8  2013 install.php
drwxr-xr-x@ 70 mmss  wheel   2.3K Aug  8  2013 misc
drwxr-xr-x@ 44 mmss  wheel   1.5K Nov 11 17:24 modules
drwxr-xr-x@  5 mmss  wheel   170B Aug  8  2013 profiles
-rw-r--r--@  1 mmss  wheel   1.5K Aug  8  2013 robots.txt
drwxr-xr-x@ 13 mmss  wheel   442B Aug  8  2013 scripts
drwxr-xr-x@  7 mmss  wheel   238B Jan 20 18:42 sites
drwxr-xr-x@  8 mmss  wheel   272B Aug  8  2013 themes
-rw-r--r--@  1 mmss  wheel    19K Aug  8  2013 update.php
-rw-r--r--@  1 mmss  wheel   2.1K Aug  8  2013 web.config
-rw-r--r--@  1 mmss  wheel   417B Aug  8  2013 xmlrpc.php
  • Where do you run it? Are you in the directory you have your Drupal installed? – Mołot May 4 '14 at 16:54
  • yes, of course I am. The thing is, all the questions I found, the people who ask them seem to have the same problem of not executing the command from within the project directory or having a multi site setup. But this doesn't apply to me. – MMSs May 4 '14 at 17:00
  • Could you post a result of ls -lah or tree, executed from the same place you are executing drush? – Mołot May 4 '14 at 17:02
  • Also, have you tried manually setting --uri=example.com? Of course with example substituted with your real domain and address... – Mołot May 4 '14 at 17:04
  • 1
    Please edit it to your question, it's not readable in comment :( – Mołot May 4 '14 at 17:18
1

Thanks to all for your efforts to help me, I figured out the issue I had finally, and here's the solution to the issue in case someone else went through the same.

The issue was that I had two versions of PHP installed, the default php command in bash was invoking a different version from that invoked by apache. Each php version had its own php.ini file, which made drush unable to connect the db, therefore, unable to do drupal update.

If anyone had a similar issue, check on the location of php.ini in both bash and apache: In bash write the following:

php -i | grep php.ini

You will get something like:

Configuration File (php.ini) Path => /etc

Next make your own phpinfo.php file in your document root to test your configuration:

phpinfo();

and open http://exmaple.com/phpinfo.php check on the "Configuration File (php.ini)" if it has a different location drush won't work.

  • How do you fix this? – MG1 Jul 21 '16 at 17:45
  • By uninstalling the php version that was triggered in the cli after finding which one was it which php – MMSs Jul 25 '16 at 16:21
-1

i had DRUSH update issues and after trying EVERYTHING I found it to be related to multi site setup.... this worked for me

drush -l example.com pm-update

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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