Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

When I run phpunit on the command line I get 'phpunit' is not recognized as an internal or external command, operable program or batch file.

php has been added to my system path. My php.ini includes include_path=".;C:\PHP\pear".

How can I get the command phpunit to be recognized by the command line?

like image 892
Will Avatar asked Jun 08 '11 12:06

Will


2 Answers

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 
like image 139
Gordon Avatar answered Oct 22 '22 23:10

Gordon


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 -> Properties 2) Advanced System Settings 3) Click "Environment variables" button 4) 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...)

like image 4
LazyOne Avatar answered Oct 22 '22 22:10

LazyOne