【问题标题】:sh: php: command not found in git bash windows 8sh:php:在 git bash windows 8 中找不到命令
【发布时间】:2014-04-02 04:43:47
【问题描述】:

我正在从 git bash CLI 运行 php composer.phar install,它显示 sh:php: Command not found。 虽然我已经将环境变量路径设置为我的 wamp/bin/php/php5.4.16/

【问题讨论】:

    标签: php git


    【解决方案1】:

    您需要将 WAMP 安装中包含 php.exe 的目录放入环境变量 PATH 中。一般类似于 C:\wamp\bin\php。

    其中 \php\ 是包含 php.exe 的目录。

    【讨论】:

      【解决方案2】:
      1. 设置 php 环境。 here. 中提到的变量(您可以使用以下命令轻松测试它:                  php -r "echo 1;"php -v
      2. 重启 git shell
      3. 如果 composer.phar 不存在,运行这个 (more info): php -r "readfile('https://getcomposer.org/installer');" | php

      4. 最终运行php composer.phar install


      在没有 git shell 的情况下运行 php:

      1. 定位C:\wamp\bin\php
      2. 按住 SHIFT 并用鼠标右键单击文件夹 phpX.Y.ZZ
      3. 选择Open command prompt window here
      4. 运行任何 php 命令,例如 php parameters

      【讨论】:

        【解决方案3】:

        无论您使用的是 gitbash 还是 cmd,您都应该以管理员身份运行它。导航到您的项目,然后键入命令“composer install”它将起作用。我的工作正常。

        【讨论】:

          猜你喜欢
          • 2016-08-16
          • 1970-01-01
          • 2017-11-19
          • 2018-08-06
          • 2019-03-31
          • 2016-01-03
          • 2020-10-25
          • 2015-08-26
          相关资源
          最近更新 更多