Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I get this strange error when I try to run a php file from anywhere in the system:

Could not open input file: drush.php.

...except for its own directory. When I try invoke it from its own directory, no problem -- everything works!

Is there a permissions issue here? I looked under security tab in the properties for the file, but every user was given all the permissions that are available.

So I don't get why Windows is not able to open this file from any other directory except where it is located.

share|improve this question
Is the .php file you're trying to run actually called drush.php? – Izzy Jul 1 '09 at 1:57
up vote 0 down vote accepted

It could be a "working directory" issue. Have you tried making a shortcut to it on the desktop, then right-click, properties, and change "start in" to the folder where the php file is?

share|improve this answer
yeah, that worked. so what do you think i should do? keep using the shortcut rather than the batch file? -- i dont know if i mentioned that the file is being invoked by drush.bat. – picardo Jul 1 '09 at 3:35
You could use the shortcut or edit the batch file to do "cd c:\yourpath" before it runs that command. You might also want to try t the PATH comment below to see if that does the trick. – Adam Brand Jul 1 '09 at 16:04

the file drush.bat from the php folder contains:

@php.exe "%~dp0drush.php" --php="php.exe" %*

I replaced it with

@php.exe "%~dp0/PEAR/drush/drush.php" --php="php.exe" %*

the actual path to the drush.php was not directly in the php folder, it was in php/PEAR/drush

share|improve this answer

Try adding the path of the PHP bin folder to your %PATH% environmental variable

Usually in C:\Program Files\PHP\bin (or C:\Program Files (x86)\PHP\bin) or C:\PHP\bin

share|improve this answer
actually i tried that. it didn't work. same error. – picardo Jul 1 '09 at 3:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.