On CentOS 6 with PHP 5.3.3 and Drupal 7:
Drush 6.2 installed using Pear works fine.
Then I needed Drush 7 so:
Drush 7 installed using Composer doesn't work.
but
Drush 6.6 installed using Composer works fine.
Drush 7 can't find the site, that's the error I get just trying to clear cache. Doesn't matter if I use an alias, or if I'm in httpdocs or sites/default.
I changed localhost to 127.0.0.1 in settings.php but no change.
I've also noticed that 7 doesn't show any database info. Probably just another symptom.
I'll try to illustrate all three versions of Drush using image-flush, sorry for the long post:
(Note that drush cc all reports No Drupal Site Found using Drush 7, the third command down. Another symptom I'm sure...)
root@venus > drush --version
Drush Version : 7.0.0
/var/www/drupal7/EXAMPLE.com/httpdocs
root@venus > drush status
Drupal version : 7.38
Site URI : http://default
PHP executable : /usr/bin/php
PHP configuration : /etc/php.ini
PHP OS : Linux
Drush script : /root/.composer/vendor/drush/drush/drush.php
Drush version : 7.0.0
Drush temp directory : /tmp
Drush configuration :
Drush alias files : /root/.drush/aliases.drushrc.php
Drupal root : /var/www/drupal7/EXAMPLE.com/httpdocs
Site path : sites/default
/var/www/drupal7/EXAMPLE.com/httpdocs/sites/default
root@venus > drush cc all
No Drupal site found, only 'drush' cache was cleared. [warning]
'all' cache was cleared. [success]
/var/www/drupal7/EXAMPLE.com/httpdocs
root@venus > drush image-flush
Command image-flush needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. [error]
The drush command 'image-flush' 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.38
Site URI : http://default
PHP executable : /usr/bin/php
PHP configuration : /etc/php.ini
PHP OS : Linux
Drush script : /root/.composer/vendor/drush/drush/drush.php
Drush version : 7.0.0
Drush temp directory : /tmp
Drush configuration :
Drush alias files : /root/.drush/aliases.drushrc.php
Drupal root : /var/www/drupal7/EXAMPLE.com/httpdocs
Site path : sites/default
drush cache-clear drush
composer global require drush/drush:6.*
composer global update
drush cache-clear drush
root@venus > drush --version
Drush Version : 6.6.0
root@venus > drush status
Drupal version : 7.38
Site URI : http://default
Database driver : mysql
Database username : xxx
Database name : xxx
Database : Connected
Drupal bootstrap : Successful
Drupal user : Anonymous
Default theme : at_one
Administration theme : seven
PHP executable : /usr/bin/php
PHP configuration : /etc/php.ini
PHP OS : Linux
Drush version : 6.6.0
Drush configuration :
Drush alias files : /root/.drush/aliases.drushrc.php
Drupal root : /var/www/drupal7/EXAMPLE.com/httpdocs
Site path : sites/default
File directory path : sites/default/files
Temporary file directory path : /tmp
/var/www/drupal7/EXAMPLE.com/httpdocs
root@venus > drush image-flush
Choose a style to flush.
[0] : Cancel
[1] : all
[2] : flexslider_full
[3] : flexslider_thumbnail
[4] : thumbnail
[5] : medium
[6] : large
[7] : 3x1_breakpoints_theme_at_one_mobile_1x
[8] : 3x1_breakpoints_theme_at_one_narrow_1x
[9] : 3x1_breakpoints_theme_at_one_normal_1x
[10] : 3x1_breakpoints_theme_at_one_wide_1x
/var/www/drupal7/EXAMPLE.com/httpdocs
root@venus > drush62 --version
Drush Version : 6.2.0
/var/www/drupal7/EXAMPLE.com/httpdocs
root@venus > drush62 status
Drupal version : 7.38
Site URI : http://default
Database driver : mysql
Database username : xxx
Database name : xxx
Database : Connected
Drupal bootstrap : Successful
Drupal user : Anonymous
Default theme : at_one
Administration theme : seven
PHP executable : /usr/bin/php
PHP configuration : /etc/php.ini
PHP OS : Linux
Drush version : 6.2.0
Drush configuration :
Drush alias files : /root/.drush/aliases.drushrc.php
Drupal root : /var/www/drupal7/EXAMPLE.com/httpdocs
Site path : sites/default
File directory path : sites/default/files
Temporary file directory path : /tmp
/var/www/drupal7/EXAMPLE.com/httpdocs
root@venus > drush62 image-flush
Choose a style to flush.
[0] : Cancel
[1] : all
[2] : flexslider_full
[3] : flexslider_thumbnail
[4] : thumbnail
[5] : medium
[6] : large
[7] : 3x1_breakpoints_theme_at_one_mobile_1x
[8] : 3x1_breakpoints_theme_at_one_narrow_1x
[9] : 3x1_breakpoints_theme_at_one_normal_1x
[10] : 3x1_breakpoints_theme_at_one_wide_1x
Comments
Same Here
Having this exact same issue on a RHEL server with php 5.3.3 using composer to install drush 7.1. Have no idea why it can't bootstrap the database.
Drush 7 needs PHP 5.4 I think
I don't know why I can't find the requirements for Drush, but on my CentOS 6 server with PHP 5.3.3 Drush 6 works but Drush 7 doesn't.
Drush 7 works on CentOS 7 with PHP 5.4.16