Installation on Windows

Drush 4 does not support Windows. However, there is an automatic installer for Drush 5. Although it does not have a stable release yet, it has all the capabilities of Drush 4.5. Hence, it is the preferred installation method in this case.

In case you experience problems using the installer, the manual installation process is explained as well in this section.

Note

Drush on Windows supports three shells: DOS, PowerShell, and msysgit (mingw). Cygwin is not formally supported, but is very similar to msysgit and should work.

Automatic installation

Drush has a Windows installer that sets up everything you need to start using Drush. The process is very similar to installing any other software in Windows.

Here are the steps to get it working:

  1. Download the installer and the Installation Guide from http://www.drush.org/drush_windows_installer.
    Automatic installation
  2. Open the Installation Guide and follow instructions to install Drush.
  3. Once the installation completes, you can open a Drush terminal from the Windows Start menu. A shortcut on your desktop has been set up as well.
    Automatic installation
  4. Both shortcuts open a Windows console configured to work with Drush. You can execute Drush commands there by typing drush.
    Automatic installation
  5. If, when you enter drush and you get the error php.exe could not be found, run PHP manually and then try again, as in the following example:
C:> php -v C:> drush

  • You should see now the list of commands and options for Drush.

Manual installation

The alternative installation method requires knowledge of the Windows system variables configuration and administrative permissions to replace a Windows library. The result has Drush 5 installed and works as the automatic installer does.

Installing required libraries

Drush needs a few libraries to be installed in order to work correctly. Take into account the following tips prior to installing them:

  • Each installer can be found in their home pages at the first setup link of the Download section.
  • When you open an installer, you may see up to three security warnings, as shown in the following screenshot, before the installation starts. Accept them, as these libraries should not involve any risk for your system.
Installing required libraries
  • During the installation process, leave all options with their default values and accept the terms of use.

Here are the home pages of each of the libraries:

Replacing the TAR Library

Now, we will replace the Windows Tar library (tar) with the one we just installed, by performing the following steps:

  1. Open the file explorer and browse to the folder C:Program FilesGnuWin32in.
  2. Rename the file tar to tar_default. If Windows asks you to confirm this operation, accept it.
  3. Make a copy of the file bsdtar (located in the same directory) and rename the copy to tar. If you can see the file extensions, keep them.
  4. Your bin folder should look as shown in the following screenshot, after doing this.
Replacing the TAR Library

Installing Drush

In a web browser, open the Drush Project page and download the zip package of the All-versions-5.x-dev release: http://drupal.org/project/drush.

Installing Drush

Extract the contents of the zip file to the root of your C drive, so drush.bat can be reached at C:drushdrush.bat.

Configure environment variables

Configure your Path system variable by going to My Computer | Properties | Advanced System Settings | Environment Variables. At the System Variables list, double-click on Path and append this at the end of the Variable value field: ;C:php;C:drush;C:Program FilesGnuWin32in.

Configure environment variables

As you can see, we are providing the Path variable with the location of the PHP, Drush, and libraries directories. Make sure that these paths are correct as in some installations they may vary (for example, WAMP installs PHP at C:wampinphp and some Windows versions have Program Files (x86) instead of Program Files). Save the value and close all the windows you opened for doing this.

Verify the installation

Open the command-line interface at Start | Programs | Accessories | Command Prompt. If you had it already opened, then close and open again so it loads the new configuration. Once in, type the following:

C:> drush core-status
PHP configuration : C:phpphp.ini Drush version : 5.0-dev Drush configuration : Drush alias files :

If you did not get the previously shown output, try to identify the error with the message reported or find more debugging information at http://drupal.org/node/594744.

Configuring php.ini

If you use the default php.ini configuration file, you may encounter unexpected errors using Drush such as timeouts, errors not being shown, or functions not being found. This is because the default configuration of PHP is too restrictive. Therefore, we will first identify where it is and if is not shared with the web server, configure it. If it is, an alternative method to override some of its settings will be explained.

You can easily find the php.ini file being used by Drush with the core-status command:

$ drush core-status PHP
PHP configuration : /etc/php5/cli/php.ini

Now, in order to find out if the web server uses this file, create a file called info.php in a directory visible by your web server:

<?php
phpinfo():

Now open it in a web browser and look for the line Loaded Configuration File:

Configuring php.ini

Note

If you created the info.php file in a public web server, do not forget to delete it.

If the file path is different from the one that drush core-status PHP reported, you are safe to go ahead configuring it. If not, create a php.ini file within the Drush installation directory (for example, at /home/juampy/drush/php.ini) with the following contents:

memory_limit = 128M
error_reporting = E_ALL | E_NOTICE | E_STRICT
display_errors = stderr
safe_mode =
open_basedir =
disable_functions =
disable_classes =

These settings make sure that Drush has enough memory to run; errors are printed onscreen and some PHP variables do not restrict it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.184.90