Drush installation in windows 7

November 11, 2013
1K
12K


Category:
Tags:

Did you ever think about DRUPAL's faster development environment? I did not think for first two years as a DRUPAL developer. Its may be lack of guidance. I faced lots of VIVA about DRUPAL from different firm, they even don't ask me about development environment. One day i realize i am taking too much time about administrating DRUPAL. So search Google and found DRUSH. DRUSH is really really a great tools for fast development. It has huge benefits.

What is DRUSH ?

Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt.

Benefits of DRUSH

Suppose you want to install a contributed module "token". What you have to do is ?

  1. Go drupal.org web site
  2. Search for token module
  3. Download it
  4. Unzip it
  5. Copy and paste to DRUPAL's module directory
  6. Open your sites in browser and logged in as admin
  7. Visit module list page
  8. Search for token module and select it
  9. Finally hit save button to enable it

Using DRUSH All these task are done in just 2 commands

  • Open your command prompt and go to DRUPAL modules folder (sits/all/modules/contrib). Command: cd wamp\www\d6test\sites\all\modules
  • To download token module; command: drush dl token
  • Now enable token module; command: drush en token

Just think, you need to install 5/10 modules ! So, its time to switching DRUSH.

In this tutorial, i will show you step by step procedure of how to setup DRUSH in windows

DRUSH installation steps:

  1. Download & Install WAMP
  2. Change default MySQL ini (my.ini) file
  3. Enable some apache module
  4. Configure php.ini file, save it and Restart all service
  5. Download DRUSH 6.x ( For PHP 5.3.x and mySQL 5.1.x
  6. Download and install some necessary library file to run DRUSH
  7. Change default tar library file
  8. Add some environment variable to run DRUSH
  9. Finally, open your command prompt and run DRUSH

Download and install WAMP

Skip this part if have WAMP installed. If not then Download WAMP from here and install it. Need help about WAMP installation? Read this tutorial

Change default MySQL ini (my.ini) file

Go to: mysql directory. In my case: D:\wamp\bin\mysql\mysql5.5.24 (Because i installed WAMP in D Drive). Open my.ini file in nodepad++/notepad. Line 3 says :
This is for a system with little memory (32M - 64M) where MySQL plays ...
Close my.ini and open my-huge.ini in notepad++. Line 3 says:
This is for a large system with memory of 1G-2G where the system runs mainly.
We need bigger memory . So rename my.ini as my_.ini . Copy my-huge.ini and paste here. Rename this file as my.ini . Lets go to next step

Enable some php & apache module

  • Enable php module if not already enable: php_mysqli, php_gd2
  • Enable apache module if not already enable: rewrite_module, alias_module

Configure php.ini file, save it and Restart all service

Open php.ini file from WAMP system tray and edit some configuration value like

  1. Change max_execution_time = 180
  2. Change upload_max_filesize = 128M
  3. Change memory_limit = 512M

Now save php.ini file and restart your WAMP

Download DRUSH

Download DRUSH from drupal.org
You need to check you PHP and MySQL version. Go to DRUSH project page on git hub and see 'DRUSH VERSIONS' section (fig:1)

Now unzip your zip file and paste it to D: Drive where WAMP directory exists. I put DRUSH directory to my D: drive

Download and install some necessary library files to run DRUSH

Since DRUSH is written mostly for LINUX, we need some utility to run DRUSH for windows.
Go to http://gnuwin32.sourceforge.net page.
Click Packages link Under download sections from left side bar and download the following 4 packages.

  1. LibArchive for Windows
  2. wget for winddows
  3. Gzip for Windows
  4. Tar for Windows

Change default tar library file

Assume all packages are installed in C:\Program Files\GnuWin32 directory.
After installed all packages, go to GnuWin32 bin directory C:\Program Files\GnuWin32\bin . Rename tar.exe as _tar.exe.
Now copy bsdtar.exe and paste here. Now rename this file as tar.exe.

Add some environment variable to run DRUSH

 

  • Go to my computer properties (right click on my computer, then click properties)
  • click advanced system settings
  • click Environment variables button
  • Select path on system variables section and click edit

Now add the following environment variables here:

  1. C:\Program Files\GnuWin32\bin (GnuWin32 bin directory)
  2. D:\wamp\bin\php\php5.3.13 (PHP installation directory)
  3. D:\wamp\bin\mysql\mysql5.5.24 (MySQL installation directory)
  4. D:\drush (DRUSH directory)

Each variable must be seperated by semicolon. So our custom variable looks like:
C:\Program Files\GnuWin32\bin;D:\wamp\bin\php\php5.3.13;D:\wamp\bin\mysql\mysql5.5.24\bin;D:\drush
Click ok to all dialog box.

 

Finally, open your command prompt and run DRUSH

Now open your command prompt and just write drush. If you see drush related help, then successfully installed DRUSH in your computer.