phpunit run from command line returns "'phpunit' is not recognized as an internal or external command, operable program or batch file." phpunit run from command line returns "'phpunit' is not recognized as an internal or external command, operable program or batch file." windows windows

phpunit run from command line returns "'phpunit' is not recognized as an internal or external command, operable program or batch file."


Make sure your PEAR installation is installed properly and available in the Windows environment. Each PEAR command has a corresponding .bat file in the PEAR installation directory, e.g. phpunit.bat. Because these are the files that get called when doing e.g. phpunit on the command line, this directory has to be on your PATH as well. Having the PEAR directory on the include_path only is not enough.

If you are sure PEAR is installed properly. reinstall PHPUnit with

pear install --alldeps --force phpunit/PHPUnit 


You need to add php path (which is C:\PHP) to the PATH variable.

On Windows 7 it will be:1) My Computer -> Right click -> Properties2) Advanced System Settings3) Click "Environment variables" button4) Find "Path" entry in "System variable" section and: a) add to the end ";C:\PHP" (without quotes) or b) add to the front "C:\PHP;"

EDIT:

php has been added to my system path.

You do need to open a new windows command prompt (no need for logoff, restart...)