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.
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.
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:
drush
. 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
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.
Drush needs a few libraries to be installed in order to work correctly. Take into account the following tips prior to installing them:
Now, we will replace the Windows Tar library (tar) with the one we just installed, by performing the following steps:
C:Program FilesGnuWin32in
. tar
to tar_default
. If Windows asks you to confirm this operation, accept it. bsdtar
(located in the same directory) and rename the copy to tar
. If you can see the file extensions, keep them. bin
folder should look as shown in the following screenshot, after doing this.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.
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 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.
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.
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.
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:
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.
3.17.184.90