Cannot install Drupal via drush in the root of site

I am going absolutely insane. I have been up for several hours scouring the internet, installing, removing, installing, removing, and I CANNOT get Drupal (7 or 8) to install at the root of a site (hosted Linux server, not local or vm). If I try to run the drush si with the package outside of the target site’s directory structure I get the site-install needs a higher bootstrap error. Of course, if I move the the install base into the root of the target site’s directory, it installs fine…in a subfolder with the name of the install base! I have followed all of the documentation, reviewed hundreds of comments on multiple sites, watched YouTube videos, looked at Pluralsight tutorials. I am at a loss. I saw suggestions to edit the settings.php file (which the install package creates during the install process and doesn’t exist beforehand…). I saw suggestions to rename files that are not yet existant because the install hasn’t happened. I’m sure much of these apply to an upgrade, but not a new site install. Can anyone please offer some insight into this. Installing with drush is supposed to make things easier. I have now wasted 4 hours trying to figure this out when I could have just manually installed it. But now it’s principle. I want to know. Besides I might have to do this again for other sites. Thank you in advance.

Drush: How do I change the Drupal root

My Drush commands doesn’t work because my Drupal files are in another directory than the one set in Drush. Everything is set up to this path so I can’t just change the folder name.

Drush status   [..]   Drupal root   : /Users/nicklas/Documents/SourceTree/Drupal/web 

How can I change the path to /docroot instead of /web?

/Users/nicklas/Documents/SourceTree/Drupal/docroot

Drush command to run cron won’t work in Crontab

I am attempting to run two Drush commands from my crontab:

# m h  dom mon dow   command */2 * * * * drush -r /path -l https://www.domain.com/ cron */2 * * * * drush -r /path -l https://www.domain.com/ -u civicron civicrm-api job.execute 

Both of these commands work when I run them manually on the server, however they do not appear to work through crontab, even though the log shows them running:

Apr 17 20:16:01 ip-000000000000 CRON[3736]: (ubuntu) CMD (drush -r /path -l https://www.domain.com/ -u civicron civicrm-api job.execute) Apr 17 20:16:01 ip-000000000000 CRON[3737]: (ubuntu) CMD (drush -r /path -l https://www.domain.com/ cron) 

Any suggestion as I cannot see why these would not be running?

Drush cim: error “Table xyz already exists”

I’m trying to deploy a dev website to a dev server. When running drush cim on the dev server, drush ends with an error message:

Table honeypot_user already exists

When running drush cim again right after that, the same error comes up again for a while with different table-names. The database does definitely not have these tables before running the config import.

What’s the underlying problem and how can I solve that?

Using drush 8.1.17 on a Drupal 8.3.7 (both running offline and soon to be updated for security patches)

Where is the `Drush` command specific documentation?

To be more specific than the title, I want to know what drush cim exactly does, like:

  • where is the drush cim command specific documentation?
  • Does cim command remove the files after they are imported, or not?
  • where are the setting files imported from, can you provide me with a path relative to the root (I mean, relative to where the main index.php file of drupal is)?
  • can we change the import path?
  • can we tell drush to just delete any (previously exported) setting files ?

drush handling array variable values

Am using drupal 7 and drush 7.4.0

How to handle drush array variables. For example: Am having a variable: social_sharing which has drush vget social_sharing

social_sharing :

facebook: facebook google_plus: google_plus linkedin: linkedin twitter: twitter pininterest: pininterest 

Using drush command,

1: How can I get the value of only facebook using drush vget?

2: How can I delete one specific variable? for example if I want to remove google_plus from the list using drush vdel?

What version of Drush is compatible with Drupal 6 / PHP 5.2

Just installed drush on a system using PHP 5.2. However, when I run drush, a message is displayed saying Your command line PHP installation is too old. Drush requires atleast PHP 5.3.0. To suppress this check, set the environment variable DRUSH_NO_MIN_PHP=1. Since I am using Drupal 6 I need to use PHP 5.2. Could someone please tell me which version of Drush is compatible with Drupal6 / PHP5.2.

How to get Drush in my path in Windows 10?

I have Drush 9 installed on Windows 10. I installed it via Composer using Lando.

I want to put this drush in my system path so that I can use it from cmd.exe, Powershell, and so on. I want to do this because I am trying to run Drupal Behat Extension tests with the Drush driver, which requires drush to be in the path.

What I tried

Windows 10 Control Panel -> System -> Edit environment variables

Under “User variables for MYUSERNAME”, I added:

  • Variable: LANDO_FRIENDS
  • Value: C:\pathtowebsiteinstalledbycomposer\vendor\bin

Then I rebooted and tried to run drush:

drush : The term ‘drush’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

So then, from PowerShell, I changed to the \vendor\bin directory and ran ./drush. This opened up a prompt How do you want to open this file?

I don’t understand why this is happening.

Here’s what does work:

  • I can run drush from Powershell using lando, i.e., lando drush status.
  • I can open up a bash shell with the Windows Linux Subsystem and go to /vendor/bin and enter ./drush, which causes drush to load normally.

So drush is definitely installed, but how do I use it from Powershell/cmd.exe?

cannot use some drush commands

I am running into some trouble with drush I can’t pm-enable the modules I just downloaded with it. I did some research but none of the solution worked for me, most cases involved switching “localhost” to “127.0.0.1” in settings.php but my database is located on a docker container. I am running drush from the root folder.

Here the output I get when running drush en module1, module2

    root@c4765ef094a2:/var/www/html# drush en pathauto, token,      simple_gmap, addtoany, scheduler, devel, devel_generate     Command pm-enable needs a higher bootstrap level to run - you will      need to invoke drush from a more functional   [error]     Drupal environment to run this command.     The drush command 'en pathauto, token, simple_gmap, addtoany,      scheduler, devel, devel_generate' could not be     [error]     executed.     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         :  8.4.0                                                                                      Site URI               :  http://default                                                                             Database driver        :  mysql                                                                                      Database hostname      :  mariadb                                                                                    Database port          :  3306                                                                                       Database username      :  root                                                                                       Database name          :  drupal                                                                                     PHP executable         :  /usr/local/bin/php                                                                         PHP configuration      :                                                                                             PHP OS                 :  Linux                                                                                      Drush script           :        /var/www/html/vendor/drush/drush/drush.php                                                 Drush version          :  8.1.15                                                                                     Drush temp directory   :  /tmp                                                                                       Drush configuration    :                                                                                             Drush alias files      :                                                                                             Drupal root            :  /var/www/html                                                                              Drupal Settings File   :  sites/default/settings.php                                                                 Site path              :  sites/default                                                                              Sync config path       :  sites/default/files/config_oL5MBo-      2_ALSPTKnAwZb1o3WVs19lndEmQpb4zfSv42kL9A8F0bp4g_de                         mvUvf96DBkH3qyYww/sync 

Here’s the output of drush sql-connect

mysql --user=root --password=root --database=drupal --host=mariadb -- port=3306 

I have been stuck on this for 2 hours so any help would be greatly appreciated

DDEV – drush uli without ‘default’ – set Site URI for Drupal 8 and Drush 9

Versions discussed: Drupal 8.6.13, Drush 9.6.1.

This is somewhat similar to How to have an environment specific drush.yml? except that the other thread is now four or five months out-of-date and Drush 9.6.1 doesn’t seem to respect the drush.yml anymore.

I’m just trying to set my Site URI.

As detailed in that thread, I’ve tried web/sites/default/drush.yml as well as many other locations for the drush.yml, done a drush cc drush, and yet drush status still reveals an incorrect Site URI of http://default, showing that it is not respecting the uri: line in any of my drush.yml files.

To complicate matters, I’m using DDEV, so following up on some suggestions that I’ve gotten from the Drupal Slack that we should really be using an environment variable (namely DRUSH_OPTIONS_URI) have proven tricky, as I’m not exactly sure where that goes inside of the DDEV environment.

Inside the DDEV container, if I do export DRUSH_OPTIONS_URI=http://my.ddev.local/ then everything works great, but once I quit the container or try to do things from outside it, such as ddev exec drush uli, things are back to the incorrect Site URI.

How can I persist this environment variable across restarts of DDEV/Docker?