6

How do I install/setup Drupal Console on Windows 7? In the video by the author, the environment used is Linux.

I tried to install it on Windows 7, but I wasn't able to use it to generate a module code.

apaderno
  • 28,547
  • 16
  • 75
  • 90
MSN
  • 566
  • 7
  • 13
  • I have no idea what your question is. I have no idea what "Drupal 8 console" is. If you want run a server and drupal on windows 7, the easiest way might be to install "wampsever", add the drupal files to the www directory. That is how I have been doing it the past few years, until I started running a virtual machine. – 2pha Dec 26 '14 at 09:35
  • Console project is available at https://www.drupal.org/project/console project help in creating modules very fast. But I am not getting it worked on windows. – MSN Dec 29 '14 at 04:38
  • Oh, well maybe do what I do and run a virtual linux server on your machine. I use virtualBox – 2pha Dec 29 '14 at 09:52
  • I have answered this drupal.stackexchange please visit [Install Drupal console on windows in 3 steps ](https://drupal.stackexchange.com/questions/221210/how-to-properly-set-up-drupal-console-on-windows-7/253997#253997) – user3127648 Jan 18 '18 at 03:58

7 Answers7

3

You can download the drupal console either using Git Bash

$curl https://drupalconsole.com/installer -L -o drupal

Or using windows command prompt

c:\>php -r "readfile('https://drupalconsole.com/installer');" > drupal

After downloading this file, place it beside php.exe file within your php folder (not project folder), restart your terminal/cmd-prompt and type

$drupal

to get started.

Besides downloading Drupal Console .phar file, you can also install Drupal Console using composer on windows.

First Download and install composer in your system.

Then on your windows command prompt or git terminal

$composer global require drupal/console:@stable
sarathkm
  • 1,306
  • 1
  • 9
  • 11
2

Create a file called drupal.bat

@php "%~dp0drupal.phar" %*
Nate
  • 167
  • 7
2

Here's the full list of steps I took:

  • php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar
  • added installation location to the global PATH
  • created a drupal.bat file in the same directory as drupal.phar. drupal.bat contains: @php "%~dp0drupal.phar" %*

Now you can call >drupal from any location. I would upvote @Nate's answer, but this is a new account.

1
  • Open Git bash (or any terminal with curl capability)
  • Run curl https://drupalconsole.com/installer -L -o drupal.phar
  • Create file drupal.bat with content @php "%~dp0drupal.phar" %*
  • Copy both files (drupal.phar and drupal.bat) into C:\WINDOWS
  • Open new Command prompt window then try typing drupal list.

This steps assume:

  • Your PHP is on Path environment variables and you can run php --version.
  • You have Git for Windows installed.
Permana
  • 1,972
  • 2
  • 33
  • 51
1

you can install drupal console using composer

open the command line on windows then go to :

cd /path/to/drupal8.dev

now you can install drupal console :

composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader

after that you installed drupal console you can use it from drupal root directory where composer.json exist as follow:

vendor/bin/drupal <the_command>

you should replace <the_command> with one of the drupal console commands. you can see complete list of the commands here: drupal console commands

Ali_Hr
  • 4,017
  • 3
  • 27
  • 34
0
  • Find a php.exe
  • Add this path to the environnement variable path
  • from terminal run

    php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar
    
  • i then use php-storm IDE :

  • file/settings/command line

  • add tool based on symfony console
  • fill php path and drupal.phar path
  • console is now set
  • tools/run command

    drupal list 
    
Matoeil
  • 6,851
  • 11
  • 54
  • 77
0

if you have php and composer all setup make sure you're in your drupal root folder..open powershell (anyother cli) and do '

composer require drupal/console

'after this add. 'C:\<path to your drupalwebsite root folder>\vendor\bin' to your paths Environment variables

and you have composer installed: Remember to install and add composer to path variables for every local drupal installation.

Nicholas
  • 77
  • 10