This is an error I am encoutnering on my WIndows Vista machine. I have put the drush directory in the path, and when I try drush.bat, this error comes up. But it also happens when I use the file location + drush.bat. Oddly enough, when I run drush.bat from its own directory, it seems to work fine. It doesn't work when I call it from any other directory.

Files: 

Comments

I am getting the same error.

solution found here:

http://drupal.org/node/330023

you need to define the hole path to the drush.php file inside the drush.bat file

Status:Active» Needs review

Change the drush.bat to:

@php.exe %0\..\drush.php %1 %2 %3 %4 %5 %6 %7 %8 %9

Assigned:Unassigned» Owen Barton

Point it to the where drush.php is at. Ex: Mine is located at C:\drush\drush.php so my drush.bat looks like:

@php.exe C:\drush\drush.php %1 %2 %3 %4 %5 %6 %7 %8 %9

Use #3 only!

hass - Tried it and it does not work in windows xp. Same error.

I know mine works however. :) Any reason not to do that?

To sum it up: we have 2 fixes - one for Vista and 1 for XP - the bat file should be patched? How?

Do we need to patch the docs/README?

Use #3 only! It works on all Windows Versions the same way!

@Durrok: I have developed it on WinXP. It must works on all NT versions. Your version is static and will not work in a general way.

for me what I did was change the .bat to read:

@php.exe "%~dp0drush.php" %1 %2 %3 %4 %5 %6 %7 %8 %9

(don't forget the quotes).

In DOS batch scripting %~dp0 represents the directory of the batch file.

As long as your php.exe and drush.bat paths are in PATH (which I changed by going to My Computer > Properties > Advanced (tab) > Environment Variables (button), and adding the "PATH" variable (without quotes) set to ";;%PATH%" (without quotes)) this should allow you to run drush from any directory.

I tried this clean variant too, but haven't worked...

I'm running Vista, Uniform Server 3.5, and the current Drush. I've installed Drush in D:\server\drush. Php is located in d:\server\wdrive\usr\local\php.

The php.ini includes a bunch of libraries referenced by: extension = [libraryname].dll for each of the libraries. I set my path to include the drush folder and the php folder as above.

In drush.bat, I changed drush.php to:
@php.exe "%~dp0drush.php" %1 %2 %3 %4 %5 %6 %7 %8 %9
(thanks leigion80 - been a long time since i've been that deep in dos scripting. nice addition.)

When I execute 'drush' (with or without a parameter) from any location (other than the php folder), I see warnings about the inability to load a php extensions library. Then I see the drush help followed by an error saying that drush.php [parameter-if supplied] can't be found:

D:\server\wdrive\usr\local>drush
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/PHP/extens
ions\php_gd2.dll' - The specified module could not be found.
in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/PHP/extens
ions\php_mbstring.dll' - The specified module could not be found.
in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/PHP/extens
ions\php_mysql.dll' - The specified module could not be found.
in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/PHP/extens
ions\php_mysqli.dll' - The specified module could not be found.
in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/PHP/extens
ions\php_pdo.dll' - The specified module could not be found.
in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/PHP/extens
ions\php_sockets.dll' - The specified module could not be found.
in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/PHP/extens
ions\php_sqlite.dll' - The specified module could not be found.
in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/PHP/extens
ions\eaccelerator.dll' - The specified module could not be found.
in Unknown on line 0

This is followed by:

Execute a drush command. Run `drush help [command]` to view command-specific help.

if no parameter is provided or:

Could not open input file: d:\server\drush\drush.php status

if a parameter (like status) is provided.

When I run within the php folder, I don't get the library errors, but I still get the same drush errors. Sounds like I have 2 problems. I want to be able to call drush from any folder (like a /sites/all/modules folder) and still have php load properly. And second, the file not found error.

Anyone else using Uniform Server? Are you having similar problems? I've been beating my head over this but I'm drooling from what I'm seing this thing being capable of. I'd really like to get this working in an XP/Vista environment.

Found a typo in my Path statement.

I've gotten rid of the drush.php not found. When I'm not in a site folder, I see the usual library load errors followed by:

Could not find a valid Drupal installation
(which is good)

When I run it in a folder with a site, I get html spit out at me which basically translates to this:

The site is currently not available due to technical problems. Please try again later. Thank you for your understanding.
If you are the maintainer of this site, please check your database settings in the settings.php file and ensure that your hosting provider's database
server is running. For more help, see the handbook, or contact your hosting provider.

The mysqli error was:
Unable to use the MySQLi database because the MySQLi extension for PHP is not installed. Check your <code>php.ini</code> to see how you can enable it..

So for me, it appears that drush is functioning with the exception of loading php correctly (which I would consider a limitation ;) ). How do I invoke php from the batch file run from within a website folder so that the integrity of php's ini file and the relative locations of the extensions (libraries) are maintained? If I figure this out, I'll be drushing away!

---UPDATE---
Great explanation of running php CLI in the Uniform Server Wiki:
http://wiki.uniformserver.com/index.php/PHP_CLI:_PHP_INI

You can create a separate php ini file for your command line PHP execution that's separate from php invoked by the server. Hope this is helpful to someone. The suggestions above put me on the right track.

@hass ... your version does not work though? If you change the path in mine (as I advise to do) that will work on any PC.

I have tried yours on three different machines with drush installed, each in a different directory, and none of them worked with your method. However if I changed the path in mine it worked every time.

I understand it will not work in a "general" way, but I think most people can understand changing a path.

I was not able to get "%~dp0drush.php" working, but also tried it... haven't had the time to dig deeper why. "%0\..\drush.php" works, but now looking on the double quotes this should be added, too only to be save than sorry.

Try prepending an echo line and see if the path makes sense. This is what the drush.bat should look like

echo %~dp0drush.php
@php.exe "%~dp0drush.php" %1 %2 %3 %4 %5 %6 %7 %8 %9

StatusFileSize
new258 bytes

Haven't seen this applied to the latest HEAD, so here's a patch for it.

could someone review the latest patch?

Hasn't worked for me.

#10 worked for me.

@hass You said that %0 worked for you but %~dp0 didn't. Did you try my suggestion and echo out the output for both? Do you mind posting the results of "%0\..\drush.php" and "%~dp0drush.php"?

Patch + #10 works for me.

The patch in #17 by legion80 works for me.

Status:Needs review» Fixed

Title:Could not open input file. drush.phpwindows batch improvement (was: Could not open input file. drush.php)
Status:Fixed» Needs review
StatusFileSize
new452 bytes

appending to this issue, as it is already referenced inside the batch file.

The %* batch parameter is a wildcard reference to all the arguments, not including %0, that are passed to the batch file.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs...

is there something to do here?

i think this might just be an improvement over the last version, in that all of the arguments that were included in the drush command are passed to the .php file, rather than the first 9 arguments.

i have not tested this yet, but if this works, then i think this should be applied.

Can anyone confirm that this most recent patch works?

yes, it works.

Status:Needs review» Reviewed & tested by the community

as it has been confirmed...

Current HEAD version does work on Win 2000 SP4. When setting the drush directory in the PATH environment variable entering "drush" is enough to run the program (no ".bat" needed).

Frank

Status:Reviewed & tested by the community» Fixed

committed #25

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Component:Code» PM (dl, en, up ...)

For any acquia stack users who stumble on the message "php5ts.dll missing" error and end up in this thread (because it it mentioned in the default drush.bat):

Try this in your bat file:

@echo off
REM See http://drupal.org/node/506448 for more information.
@"C:\Program Files (x86)\acquia-drupal\php\php.cmd" "%~dp0drush.php" %*