1

I have installed Drush 8.1.2 on Windows 7, but it doesn't work. Few command are working, but few are not working.

  • drush uli 1 works
  • drush dl <project name> works
  • drush en <project name> doesn't work
  • drush cc all doesn't work

Running drush en "module name", I get the following:

Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. The drush command 'en fieldupdate' could not be executed.
Drush was not able to start (bootstrap) the Drupal database.
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.34
    Site URI : http://default
    Database driver : mysql
    Database hostname : localhost
    Database port :
    Database username : root
    Database name : staticpages
    PHP configuration : C:\xampp\php\php.ini
    PHP OS : WINNT
    Drush script : C:\Users\ins237\AppData\Roaming\Composer \vendor\drush\drush\drush
    Drush version : 8.1.2
    Drush temp directory : C:/Users/ins237/AppData/Local/Temp
    Drush configuration :
    Drush alias files :
    Drupal root : C:\xampp\htdocs\cms-staticpages
    Drupal Settings File : sites/default/settings.php
    Site path : sites/default

2
  • I also tried with drush 7.3 and getting same error. Jul 18, 2016 at 10:04
  • Honestly, do yourself a favor and start working with a UNIX based OS.
    – leymannx
    Mar 5, 2017 at 18:43

2 Answers 2

1

Looks like your database cannot be contaced, run drush status to make sure of that. If that's the issue, then you should update your settings.php files with the correct ip, I guess 127.0.0.1 for your xampp stack.

Not an answer to your question, but running PHP/Drupal on Windows is just asking for problems. You should look into Vagrant or Docker to run your Drupal sites on Windows, that will save you a lot of pain in the long run AND will make it easier to deploy your sites later on.

2
  • Database connection is okay, if so this will not run on my machine. Jul 18, 2016 at 10:05
  • "drush uli 1 works" This needs database connection to work.
    – rovr138
    Mar 5, 2017 at 19:30
0

You should take a look at the **Drupal Console project.*

Drupal Console is abstracted on top of Symfony and such an abstraction provides better cross-platform compatibility.

In this post you can find example commands to completely setup a Drupal installation from console on Windows (without Linux bash, real Command line or Powershell scripts):

http://www.drupalonwindows.com/en/blog/continuous-integration-and-testing-drupal-appveyor

The sample commands there include:

  • Setting up a code base from scratch using Composer
  • Installing the website from the command line using "drupal install" command.
  • Enabling/downloading modules using composer and the "drupal module:install" command.
  • Running drupal tests from the console

Not an answer to your question, but running PHP/Drupal on Windows is just asking for problems.

It depends on your budget.

If you are doing brochureware/low budget, you are better off not even setting up an environment at all and looking a Platform.sh, Acquia, Pantheon, etc.

Indeed, Wordress is a much better product for such scenarios (low budget/quickies).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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