简体   繁体   English

phpunit 从命令行运行返回“'phpunit' 不是内部或外部命令、可运行程序或批处理文件。”

[英]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.当我在命令行上运行phpunit时,我得到'phpunit' is not recognized as an internal or external command, operable program or batch file.

php has been added to my system path. php 已添加到我的系统路径中。 My php.ini includes include_path=".;C:\PHP\pear" .我的 php.ini 包括include_path=".;C:\PHP\pear"

How can I get the command phpunit to be recognized by the command line?如何让命令 phpunit 被命令行识别?

Make sure your PEAR installation is installed properly and available in the Windows environment.确保您的PEAR 安装正确安装并且在 Windows 环境中可用。 Each PEAR command has a corresponding.bat file in the PEAR installation directory, eg phpunit.bat.每个PEAR 命令在PEAR 安装目录下都有一个对应的.bat 文件,例如phpunit.bat。 Because these are the files that get called when doing eg phpunit on the command line, this directory has to be on your PATH as well.因为这些是在命令行上执行例如 phpunit 时被调用的文件,所以该目录也必须在您的 PATH 中。 Having the PEAR directory on the include_path only is not enough.仅在 include_path 上有 PEAR 目录是不够的。

If you are sure PEAR is installed properly.如果您确定 PEAR 已正确安装。 reinstall PHPUnit with重新安装 PHPUnit 与

pear install --alldeps --force phpunit/PHPUnit 

You need to add php path (which is C:\PHP) to the PATH variable.您需要将 php 路径(即 C:\PHP)添加到 PATH 变量中。

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;"在 Windows 7 上,它将是:1)我的电脑 -> 右键单击 -> 属性 2)高级系统设置 3)单击“环境变量”按钮 4)在“系统变量”部分找到“路径”条目,然后:a)添加到结尾 ";C:\PHP" (不带引号)或 b) 添加到前面的 "C:\PHP;"

EDIT:编辑:

php has been added to my system path. php 已添加到我的系统路径中。

You do need to open a new windows command prompt (no need for logoff, restart...)确实需要打开一个新的 windows 命令提示符(无需注销,重新启动...)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Symfony3:从命令行运行的phpunit返回“'phpunit'未被识别为内部或外部命令,可操作程序或批处理文件。” - Symfony3 : phpunit run from command line returns “'phpunit' is not recognized as an internal or external command, operable program or batch file.” 数组(PHP中的数组([0] =>'c:\\ Program'不被识别为内部或外部命令,[1] =>可操作程序或批处理文件。) - Array ( [0] => 'c:\Program' is not recognized as an internal or external command, [1] => operable program or batch file. ) in php 当我在 Windows 上运行 composer 时,我收到一个错误“php.exe”不是内部或外部命令、可运行程序或批处理文件。 - When I run composer on Windows, I get an error of 'php.exe' is not recognized as an internal or external command, operable program or batch file.' 无法将“节点”识别为内部或外部命令,可操作程序或批处理文件。 -Browsershot - 'node' is not recognized as an internal or external command, operable program or batch file. - Browsershot 'git'不被识别为内部或外部命令,可操作程序或批处理文件 - 'git' is not recognized as an internal or external command, operable program or batch file 'C:\\wmic' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'C:\wmic' is not recognized as an internal or external command, operable program or batch file 'bin'不被识别为内部或外部命令,可操作程序或批处理文件 - 'bin' is not recognized as an internal or external command, operable program or batch file 'service' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'service' is not recognized as an internal or external command, operable program or batch file 'Rscript' 不是内部或外部命令,也不是可运行的程序 或批处理文件 - 'Rscript' is not recognized as an internal or external command, operable program or batch file 'mv'不被识别为内部或外部命令,可操作程序或批处理文件 - 'mv' is not recognized as an internal or external command, operable program or batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM