【问题标题】:phpunit run from command line returns "'phpunit' is not recognized as an internal or external command, operable program or batch file."phpunit 从命令行运行返回“'phpunit' 不是内部或外部命令、可运行程序或批处理文件。”
【发布时间】:2011-09-10 19:52:20
【问题描述】:

当我在命令行上运行phpunit 时,我得到'phpunit' is not recognized as an internal or external command, operable program or batch file.

php 已添加到我的系统路径中。 我的 php.ini 包含include_path=".;C:\PHP\pear"

如何让命令phpunit被命令行识别?

【问题讨论】:

    标签: php windows windows-7 phpunit


    【解决方案1】:

    您需要将 php 路径(即 C:\PHP)添加到 PATH 变量中。

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

    编辑:

    php 已添加到我的系统路径中。

    确实需要打开一个新的 Windows 命令提示符(无需注销、重新启动...)

    【讨论】:

    • 在我的路上可以从任何地方调用 pear
    • @Will:好的,从那方面来说一切都很好。怎么样:你有 C:\PHP\PEAR\PHPUnit 吗?也许(只是也许)它被安装到错误的文件夹中。能否请您对 phpunit.bat 文件进行全局搜索。
    【解决方案2】:

    确保您的 PEAR installation is installed properly 在 Windows 环境中可用。每个 PEAR 命令在 PEAR 安装目录中都有一个对应的 .bat 文件,例如phpunit.bat。因为这些是在执行时被调用的文件,例如phpunit 在命令行上,这个目录也必须在你的 PATH 上。仅在 include_path 上有 PEAR 目录是不够的。

    如果您确定 PEAR 已正确安装。用

    重新安装PHPUnit
    pear install --alldeps --force phpunit/PHPUnit 
    

    【讨论】:

    • C:\Users>pear install --alldeps --force phpunit/PHPUnit phpunit/PHPUnit 可以选择使用PHP扩展“dbus”下载PHPUnit-3.5.14.tgz ...开始下载PHPUnit -3.5.14.tgz(118,697 字节)..........................完成:118,697 字节安装好:channel://pear.phpunit .de/PHPUnit-3.5.14
    • 我已经重新安装,文件夹现在是htere但没有bat文件
    • @Will 现在尝试在命令行执行phpunit 命令会发生什么?
    猜你喜欢
    • 2017-10-15
    • 1970-01-01
    • 1970-01-01
    • 2018-08-25
    • 2014-06-01
    • 2022-01-06
    • 2016-07-07
    • 2021-12-20
    • 2016-12-03
    相关资源
    最近更新 更多