当我在命令行上运行phpunit
时,我得到'phpunit' is not recognized as an internal or external command, operable program or batch file.
php已经添加到我的系统路径中。我的php.ini包含include_path=".;C:PHPpear"
。
如何通过命令行识别phpunit命令?
确保您的PEAR安装已正确安装,并且在Windows环境中可用。每个PEAR命令在PEAR安装目录中都有一个相应的.bat文件,例如phpunit.bat。因为这些文件是在命令行上执行例如phpunit时调用的,所以这个目录也必须在PATH上。仅在include_path上拥有PEAR目录是不够的。
如果您确信PEAR安装正确。使用重新安装PHPUnit
pear install --alldeps --force phpunit/PHPUnit
您需要将php路径(即C:\php)添加到path变量中。
在Windows 7上,它将是:1) 我的电脑->右键单击->属性2) 高级系统设置3) 点击"环境变量"按钮4) 在"系统变量"部分找到"路径"条目,然后:a) 添加到末尾";C:\PHP"(无引号)或b) 添加到前面的"C:\PHP;"
编辑:
php已经添加到我的系统路径中。
您do需要打开一个新的windows命令提示符(无需注销、重新启动…)