1

Ubuntu 16.04 localhost Drush 8.1.10 installed via composer as per the recommended route. Drupal 8.3

Drush runs and completes some tasks. eg

drush status

PHP executable : /usr/bin/php
PHP configuration : /etc/php/7.1/cli/php.ini
PHP OS : Linux
Drush script : /home/rich/vendor/drush/drush/drush.php
Drush version : 8.1.10
Drush temp directory : /tmp
Drush configuration :
Drush alias files :

However when I try other commands I get errors

eg

drush up

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] The drush command 'up' could not be executed.

and

drush rebuild

Command cache-rebuild 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 cache-rebuild requires Drupal core version 8+ to run.
[error] The drush command 'rebuild' could not be executed.

Which is very odd as I am using D8.3 as confirmed via 'Status report'.

I have tried

composer install

Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Generating autoload files

So all looks good there.

drush cc --root=http://localhost/drupal8-test1/

Enter a number to choose which cache to clear.
[0] : Cancel
[1] : drush

Drush does not find my install - which is installed and running fine

My settings.php

$databases['default']['default'] = array (
'database' => 'drupal8-test1',
'username' => '',
'password' => '
',
'prefix' => '',
'host' => '127.0.0.1',
'port' => '3306',
'namespace' => 'Drupal\Core\Database\Driver\mysql',
'driver' => 'mysql', );

PATH in bash.rc

export PATH=$HOME/.config/composer/vendor/bin:$PATH export PATH=/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH

Seems correct to me ...?

I have tried Forcing 127.0.0.1 instead of localhost.

I am running drush from drupal root directory.

I would greatly appreciate any suggestions as to where to go next with this. :)

  • Looks like Drush isn't able to connect to your database. Did you install the php-mysql package on your server? – Gun5m0k3 Apr 20 '17 at 20:01
  • Yes, I agree that seems to be the case - can't connect/find database. I thought I had already added that package ... anyway, I hadn't and I have now - but things are unchanged. Same errors returned. – avocado Apr 21 '17 at 8:46
  • Are you 100% sure you are running Drush from the right directory? The output from drush status indicates that you are outside the Drupal directory. Could run drush status from the sites directory? – hansfn Apr 24 '17 at 15:32
  • I am in the drupal root. Runs the same in 'sites'; > sites$ > drush status > PHP executable : /usr/bin/php > PHP configuration : /etc/php/7.1/cli/php.ini > PHP OS : Linux > Drush script : /home/rich/vendor/drush/drush/drush.php > Drush version : 8.1.10 > Drush temp directory : /tmp > Drush configuration : > Drush alias files : – avocado Apr 24 '17 at 16:47
  • Solved by adding "--root=/full/path/to/your/webroot" to the drush command. Thanks all :) – avocado Apr 26 '17 at 10:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.