logo
Submitted by Mikhail Ismajlov on Mon, 09/23/2019 - 13:14

In this article, we will not write code, but prepare to write code. To do this, we will install Drush. Drush is a console utility that allows you to perform many routine operations with Drupal: update modules, upload / download configuration, backup and much more.

If you use Open Server as a web server for development, then this instruction will suit you:

1. Install the server itself. You can download it from the author's website open-server.ru. Installation and documentation there.

2. After installing Open Server, or if you already have Open Server installed, you need to register a Windows variable in your PATH.

C:\Users\yourUserName\AppData\Roaming\Composer\vendor\bin;C:\OpenServer\modules\php\PHP-5.6;C:\OpenServer\modules\database\MySQL-5.5\bin

Depending on the selected default version of MySQL and PHP, the folders PHP-5.6, MySQL-5.5 may vary depending on your version.

In newer versions, the default folder for open server is now called OSPanel:

C:\OSPanel\modules\php\PHP-7.0-x64;C:\OSPanel\modules\database\MySQL-5.7-x64\bin

variable

This is necessary in order to get rid of this error: needs a higher bootstrap level to run …

drush

Open Server also uses its Path variable. In the settings, set the use of the Path variable of the system. You also need to create a file in the folder: \userdata\config\path.txt and duplicate your Path variable there.

path

3. Install Composer: https://getcomposer.org/download/

Composer is also a console utility, but only it works with many libraries in PHP. It allows you to maintain current versions of your libraries. If the installation goes well, then you can check the composer from anywhere, just run the command, which will show the version of your composer:

composer -V

Also, composer is already installed if you use the Open Server console in the settings menu, select Advanced -> Console.

4. Install Drush itself:

composer global require drush/drush:8.*

If you need to install 9. * version of drush, then specify the desired version.

composer global require drush/drush:9.*

We need a drush version no lower than 8th. Next, perform the installation:

composer global install

Now drush will be available for any site. To check which version of Drush you have, run the command:

drush version

Now you need to add packages for working with archives.

Download and install additional programs in C: \ Program Files \ GnuWin32 (For 64-bit Windows C:\Program Files (x86)\GnuWin32):

- LibArchive

- gzip

- unzip

- WGet

Copy and rename the file C:\Program Files\GnuWin32\bin\bsdtar.exe to C:\Program Files\GnuWin32\bin\tar.exe. (For 64-bit Windows C:\Program Files (x86)\GnuWin32)

Editing the PATH environment variable: Control panel ›System› Advanced system settings ›Advanced› Environment variables ›System variables› Path

C:\Program Files\GnuWin32\bin\ or C:\Program Files (x86)\GnuWin32\bin\ for 64-bit Windows.
If drush is working for you, then you will see your version of drush. In the following articles we will discuss how to use drush. If you have any errors, you can write in the comments.