Starting points
* Drush generally works on the machine and on other sites but on some sites it does not fully work. E.g. it works for a.abc.com but not for b.abc.com which I access using the same ssh user.
* I don't have root access so I can't install head directly and have not yet since the error seems to be rather something I do wrong than drush does wrong. Of cause if it's likely that the error could be fixed in head I'll update it.
* I have searched the issues, FAQ and while many have seen this message I couldn't yet find the exact issue. http://drupal.org/node/538702 May be related though
* The error appears on a fresh working install with a Drupal core only.
* drush dl
always works. drush up
fails with following error message.
Details
abc@myhost:~/subdomains/bbb/httpdocs$ drush up --debug
Bootstrap to phase 0. [0.01 sec, 2.06 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.02 sec, 2.26 MB] [bootstrap]
Bootstrap to phase 6. [0.04 sec, 5.36 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.04 sec, 5.36 MB] [bootstrap]
Initialized Drupal 7.9 root directory at /var/www/vhosts/abc.net/subdomains/bbb/httpdocs [0.05 sec, 6.77 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.05 sec, 6.77 MB] [bootstrap]
Initialized Drupal site default at sites/default [0.05 sec, 6.77 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.06 sec, 6.78 MB] [bootstrap]
mysql extension for PHP PDO is not installed. Check your php.ini to see how you can enable it. [0.06 sec, 6.79 MB] [bootstrap]
Bootstrap to phase 5. [0.06 sec, 6.79 MB] [bootstrap]
Bootstrap to phase 6. [0.06 sec, 6.79 MB] [bootstrap]
Command pm-update needs a higher bootstrap level to run - you will need invoke drush from a more functional Drupal environment to run this command. [0.06 sec, 6.79 [error]
MB]
Command pm-update needs the following modules installed/enabled to run: update. [0.06 sec, 6.79 MB] [error]
The drush command 'up' could not be executed. [0.06 sec, 6.8 MB] [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This error often occurs when Drush is trying to bootstrap a site that has not been installed or does not have a configured database.
Drush was attempting to connect to :
Drupal version : 7.9
Site URI : http://default
Database driver : mysql
Database hostname : localhost
Database username : xxx
Database name : xxx
Default theme : garland
Administration theme: garland
PHP configuration :
Drush version : 4.5
Drush configuration:
Drush alias files :
Drupal root : /var/www/vhosts/abc.net/subdomains/bbb/httpdocs
Site path : sites/default
Modules path : sites/all/modules
Themes path : sites/all/themes
File directory path: sites/default/files
%paths : Array
You can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line or $options['uri'] in your
drushrc.php file.
[0.07 sec, 6.8 MB]
Using the --uri parameter doesn't help:
abc@myhost:~/subdomains/bbb/httpdocs$ drush up --debug --uri http://bbb.abc.net
Bootstrap to phase 0. [0.01 sec, 2.06 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.02 sec, 2.27 MB] [bootstrap]
Bootstrap to phase 6. [0.04 sec, 5.36 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.04 sec, 5.36 MB] [bootstrap]
Initialized Drupal 7.9 root directory at /var/www/vhosts/abc.net/subdomains/bbb/httpdocs [0.05 sec, 6.77 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.05 sec, 6.77 MB] [bootstrap]
Initialized Drupal site 1 at sites/default [0.05 sec, 6.78 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.05 sec, 6.78 MB] [bootstrap]
mysql extension for PHP PDO is not installed. Check your php.ini to see how you can enable it. [0.05 sec, 6.79 MB] [bootstrap]
Bootstrap to phase 5. [0.05 sec, 6.79 MB] [bootstrap]
Bootstrap to phase 6. [0.06 sec, 6.79 MB] [bootstrap]
Command pm-update needs a higher bootstrap level to run - you will need invoke drush from a more functional Drupal environment to run this command. [0.06 sec, 6.79 [error]
MB]
Command pm-update needs the following modules installed/enabled to run: update. [0.06 sec, 6.79 MB] [error]
The drush command 'up http://bbb.abc.net' could not be executed. [0.06 sec, 6.8 MB] [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This error often occurs when Drush is trying to bootstrap a site that has not been installed or does not have a configured database.
Drush was attempting to connect to :
Drupal version : 7.9
Site URI : 1
Database driver : mysql
Database hostname : localhost
Database username : xxx
Database name : xxx
Default theme : garland
Administration theme: garland
PHP configuration :
Drush version : 4.5
Drush configuration:
Drush alias files :
Drupal root : /var/www/vhosts/abc.net/subdomains/bbb/httpdocs
Site path : sites/default
Modules path : sites/all/modules
Themes path : sites/all/themes
File directory path: sites/default/files
%paths : Array
You can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line or $options['uri'] in your
drushrc.php file.
[0.06 sec, 6.8 MB]
The Message mysql extension for PHP PDO is not installed. Check your php.ini to see how you can enable it.
lookes very interesting since it does not appear in the debugged output of a working site:
user@host:~/httpdocs$ drush st --debug
Bootstrap to phase 0. [0.01 sec, 2.06 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 2.26 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.04 sec, 5.36 MB] [bootstrap]
Initialized Drupal 6.22 root directory at /var/www/vhosts/working-domain.de/httpdocs [0.04 sec, 6.16 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.05 sec, 6.16 MB] [bootstrap]
Initialized Drupal site default at sites/default [0.05 sec, 6.16 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.05 sec, 6.16 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.05 sec, 6.2 MB] [bootstrap]
Successfully connected to the Drupal database. [0.05 sec, 6.2 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.06 sec, 6.55 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_login() [0.19 sec, 27.73 MB] [bootstrap]
Successfully logged into Drupal as Gast (uid=0) [0.19 sec, 27.73 MB] [bootstrap]
Found command: core-status (commandfile=core) [0.19 sec, 27.73 MB] [bootstrap]
Initializing drush commandfile: user [0.19 sec, 27.73 MB] [bootstrap]
Drupal version : 6.22
Site URI : http://default
Database driver : mysql
Database hostname : localhost
Database username : xxx
Database name : xxx
Database : Connected
Drupal bootstrap : Successful
Drupal user : Gast
Default theme : userw
Administration theme : userw
PHP configuration :
Drush version : 4.5
Drush configuration :
Drush alias files :
Drupal root : /var/www/vhosts/working-domain.de/httpdocs
Site path : sites/default
File directory path : sites/default/files
Command dispatch complete [0.19 sec, 27.73 MB] [notice]
Timer Cum (sec) Count Avg (msec)
page 0.144 1 143.58
Peak memory usage was 27.85 MB [0.19 sec, 27.73 MB] [memory]
However using drush php-eval "phpinfo();"
everything appears to be fine:
PDO
PDO support => enabled
PDO drivers => sqlite, sqlite2
pdo_sqlite
PDO Driver for SQLite 3.x => enabled
PECL Module version => (bundled) 1.0.1 $Id: pdo_sqlite.c 293036 2010-01-03 09:23:27Z s $
SQLite Library => 3.3.7
And it is the same as in the folder where drush up is working:
PDO
PDO support => enabled
PDO drivers => sqlite, sqlite2
pdo_sqlite
PDO Driver for SQLite 3.x => enabled
PECL Module version => (bundled) 1.0.1 $Id: pdo_sqlite.c 293036 2010-01-03 09:23:27Z s $
SQLite Library => 3.3.7
What's next?
So maybe (hopefully) I am missing something obvious or maybe someone can give me a hint what to check next.
I'd appreciate it a lot. :)
Comments
Comment #1
Garrett Albright CreditAttribution: Garrett Albright commentedIt appears that your PHP installation has support for SQLite via PDO installed, but not MySQL. If you want to use Drush (or Drupal 7, for that matter) with MySQL, you'll have to rectify this.
Comment #2
osmanWell, I had exact same problem. And it wasn't because of the PDO or MySQL drivers.
I initially installed Drush on my Mac OS X Lion via pear.
But pear installed drush to the same location as it was, to the /Applications/MAMP/bin/php/php5.3.6/bin directory.
Apparently there are some permission issues on the Max OS X for drush and pear.
Check out those references:
http://blog.stealth35.com/2011/07/27/install-pear-on-osx-lion.html
http://ericlbarnes.com/post/10728804424/php-pear-and-phpunit-with-mamp-pro
http://echodittolabs.org/blog/2011/02/fix-pear-permissions-problem-mac-os-x
Once I realized it was related with the permission issues, I decided to uninstall drush completely.
I installed Homebrew, and then drush via homebrew.
Now everything works just fine. Hope this helps.
Cheers,
Comment #3
s.Daniel CreditAttribution: s.Daniel commented@Garrett: Thank you for your response.
The sites I am refering to are up and running without problems only drush is not. phpinfo does not return a difference in that matter between a working and not working site so I don't know what I could fix here. phpinfo shows little difference:
@osman Thanks for sharing.
We're on ubuntu and drush is working on some sites. Was that the case for you as well or did drush not work at all? I access drush for both sites with the same user and drush is starting but it shows the message "Drush was not able to start (bootstrap) the Drupal database. "
Comment #4
osman@s.Daniel: In my case as I recall all the websites was showing the same symptoms. The same Drush command either would work for all or not.. My issue was related with file system permissions, at least I am almost sure of it.
Check out these and post your finding here.
Comment #5
jonhattan@s.Daniel, in regards to
/var/www/vhosts/abc.net/subdomains/bbb/httpdocs
, as you mentioned #538702: Drush fails if parent of Drupal root directory contains a backup of the settings.php file, there's a settings.php in a parent directory? In that case, try the patch there (surely may need a reroll).On the other hypotesis: you need PDO support for mysql in php-cli to use drush with d7 sites. d6 doesn't use PDO. That could explain your report.
Comment #6
ahimsauziI has a similar issue locally using MAMP. I had to set up the soft link
$ ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
and all is good.Following this discussion: http://drupal.org/node/801668#comment-3083960 #16
Comment #7
s.Daniel CreditAttribution: s.Daniel commentedThank you for your comments and tips.
There was indeed a another php configuration loaded for the console. We had a custom binary in place that was missing the propper pdo settings.
Comment #8
Amit Dwivedi CreditAttribution: Amit Dwivedi commentedHi all,
I recently experiencing the same problem on my local after i installed the zend server few days before. But due to this problem i uninstall the zend server and my drupal site is working fine but drush is showing this error:
I enquired about the php.ini config file :
Macbook-Air:drupal7 apple$ which php
/opt/local/bin/php
Macbook-Air:drupal7 apple$ whereis php
/usr/bin/php
Macbook-Air:drupal7 apple$ type -a php
php is /opt/local/bin/php
php is /usr/bin/php
I think drush is not able to load php.ini file. How to force drush to use the same config file as my drupal installation.
Any Help would be great ???
Comment #10
aprice42 CreditAttribution: aprice42 commentedfor any out there who is still banging their head against a wall on this one, as I was for nearly 4 hours today....
I am working on both D7 and D6 sites using MAMP 2.x on Mac OSX Mountain Lion and here is what finally worked for me:
- be sure to set MAMP to use PHP 5.3.14 (needed for D7)
- edit the 5.3.14 php.ini file
- increase memory to 500M (increased for drush usage in step below)
- increase max_execution time to 100 (increased for drush usage in step below)
- copy the entire contents of the php.ini file and paste them into a new file here ~/.drush/php.ini
- run the following commands thank you to WebbyKat
-restart MAMP
- quit terminal
- Drush works!
I hope this can help someone else.
Comment #11
cdmo CreditAttribution: cdmo commentedOn MAMP 2.0, Mountain Lion, Drush 5.8 installed at ~/drush. All I had to do to fix this was copy MAMP's php.ini into ~/drush/php.ini, as previous poster suggested. I think the potential problem is that I have two copies of PHP installed locally. I was getting the error
Command pm-list needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. [error]
when attemptingdrush pml
. Specifying uri in command and drush alias file both did nothing.Comment #12
Amit Dwivedi CreditAttribution: Amit Dwivedi commentedhello cdmo,
Your problem is that you have to change your directory to the root of your drupal installation. Then only drush commands will work properly.
ex.
cd drupal7/
then use drush dl or whatever commands you want to run.
Comment #13
cdmo CreditAttribution: cdmo commentedHello Amit, first of all, my comment above is there because I fixed my problem and I left it there for future users who are experiencing this same problem. Being in the directory where drupal was installed was not the problem, sorry that I didn't specify that.
Comment #14
dnmurray CreditAttribution: dnmurray commentedCame here with the exact same problem, on OS X with PHP installed with macports. My problem turned out to be that I had packages for php5 and php53 installed and they were not configured the same way. Users www and root were running php53 and my user was running php5. Removing php5 packages completely solved the problem.
Comment #15
Garrett Albright CreditAttribution: Garrett Albright commentedAh, yes, that could be a problem. For those that want to check, you can quickly determine what version of PHP you're running in the CLI by doing
php -v
, and you can see what configuration files it's using by checking the output ofphp -i
(orphp -i | grep '\.ini'
to see just the relevant bits). If the output of those are different from what you see when you go to Administration > Reports > Status report and click the "More information" link next to the PHP version number, you're likely going to have some headaches.Comment #16
RaulMuroc CreditAttribution: RaulMuroc commentedIt didn't work because mysql.exe was not there in the system PATH. So I added H:\xampp\mysql\bin to PATH and then it worked! (in Mac Os X usually in /usr/local/mysql/bin)
Comment #17
sparker888 CreditAttribution: sparker888 commentedI struggled with this issue for a long time, and through reading many articles and forums, a lot of blood, sweat and tears, I finally figured out this solution:
NOTE: I am on Win 8.1, but most of these instructions came from various Win 7 installs and they still worked.
My Dev Environment: For the stack I'm using Dev Desktop from Acquia (I do NOT recommend DD2), Git for Windows (git bash), and Drush for Windows
There are several resources for installing Dev Desktop, Git, and Drush together, namely: http://friendlydrupal.com/screencasts/windows-tools-git-drush-acquia-dev... and I also found this helpful (but note differences below): http://wiki.drupalwxt.org/architecture/getting-started-win/
This last article also references this one which is very helpful when installing Drush for Windows: https://www.drupal.org/node/1843176
1. You MUST update your Environmental Variables User $PATH to include: C:\Program Files\acquia-drupal\mysql\bin;
2 You MUST also include several drush paths in the same User $PATH IF the drush installer didn't already do this for you (it usually does, but there are some reported problems on certain Windows installations)
Here is the exact code I use (including the one mentioned in 1. above):
C:\ProgramData\Drush\;C:Program Files (x86)\Drush\GnuWin32\bin;C:\Program Files (x86)\Drush\Php;C:\Program Files (x86)\Drush\cwRsync\bin;C:\Program Files\acquia-drupal\mysql\bin;
3. You MUST add a new entry in your hosts file (C:\Windows\System32\drivers\etc\hosts): 127.0.0.1 yoursitename
Note: If you have a site name such as yoursitename.localhost from when you configured/named your site in Dev Desktop, it DOES NOT MATTER. Keep the basic site name as shown above.
4. You MUST create a local drush alias for the site using the following format:
NOTE: In the URI, if your site is named mysite.localhost, change this to mysite.localhost here, but NOT in db-url
NOTE: If you are using root with no password in the database (not a good practice btw), you can leave out the password
5. Be sure and follow the naming convention for naming aliases: yoursitename.aliases.drushrc.php (typically you put the alias files in the ~/.drush/ folder, but there are other options that you can read about).
6. Assuming you're using sites/all/yoursitename, make sure and change default.settings.php to settings.php (no need to modify this one)
7. Open Git Bash (or close and re-start it)
8. Test to see that drush can read your aliases using:
drush sa
(you should see @yoursitename and perhaps others in a list)
9. Next, test your alias is working using:
drush @yoursitename status
(you should see a bunch of info related to your site with no errors)
If that works, you can test to make sure you're hooked up to the database by using:
drush @yoursite cc
You should get a list of 10 caches you can clear. Just choose one (like 1) and hit Enter. If that works, you should be in business
10. Navigate to your site directory and perform an update:
drush up
If all works correctly, drush will take you through the update process [success], and you have successfully connected to your database and updated your site through drush! xD
11. If you get an error related to missing the update module, you need to enable the core Update Manager module on your site.
If you have any problems between 8-11, try:
drush cc drush
This clears the drush cache and you can try the drush commands again. If that fails, try quitting and re-starting your git bash shell as well. If you are still receiving errors at this point, you need to go back and check to make sure everything is perfectly coded. The smallest thing (especially path settings or incorrect database paths, site name or credentials in the drush alias file) will break it.
Also, I renamed my folder in C:\Program Files (x86)\acquia-drupal\drush to 'old-drush' so Dev Desktops internal drush wouldn't interfere. I tried many things to make this drush work, and never succeeded, so I ditched it.
I'll try to answer any questions and update this procedure as needed. If there is something that I'm missing, doing wrong, or a better fix, please let me (and the community) know. However after weeks of trial and error and meticulous documentation, I believe this should be accurate. Good Luck!
Comment #18
emmonsaz CreditAttribution: emmonsaz as a volunteer commented#14 pointed me in the right direction. Try running these commands and verifying mysql is listed for both:
For us, the mysql PDO driver was missing for Drush (as indicated in the second command above) so I modified the drush alias to point to the correct version of PHP (as indicated in the first command above) as described here: https://www.drupal.org/node/1302418
Comment #19
solodky CreditAttribution: solodky commentedwow,,thanks I aDDED MYSQL TO MY Path..and that did it,,,now Drush Pm-List works
Comment #20
jfcolomer CreditAttribution: jfcolomer as a volunteer commented#10 worked for me!
Comment #21
muranod CreditAttribution: muranod commentedThanks, everyone, and thank you, Raul (#16) I've been struggling for about 16 hours to get Drush8 to work with Drupal 8 and just now got it to work by putting mysql into the path. Now I just need to figure out the "invalid placeholder" error messages, but I just FINALLY used it to enable a module.
Comment #22
rakesmh14 CreditAttribution: rakesmh14 commented#19 worked for me Thanks!
Comment #23
madhavvyas CreditAttribution: madhavvyas as a volunteer commented#17 works for me in Drupal 8, Thanks a ton