bash 在 IIS 7.5 上安装 Composer

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31928100/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 13:24:56  来源:igfitidea点击:

Installing Composer on IIS 7.5

phpbashiisiis-7.5composer-php

提问by suncoastkid

I'm trying to install Composer on IIS 7.5. When I run Composer-Setup.exe, it fails with:

我正在尝试在 IIS 7.5 上安装 Composer。当我运行 Composer-Setup.exe 时,它​​失败了:

The PHP exe file you specified did not execute correctly: C:\Program Files (x86)\PHP\php.exe

Running it from the command line might highlight the problem. Use the -v switch to show the PHP version - it must be at least 5.3.2 Internal Error [ERR_STATUS], exit code 255

您指定的 PHP exe 文件没有正确执行:C:\Program Files (x86)\PHP\php.exe

从命令行运行它可能会突出问题。使用 -v 开关显示 PHP 版本 - 它必须至少为 5.3.2 内部错误 [ERR_STATUS],退出代码 255

I'm using PHP 5.6.9, so then I run the following bash:

我使用的是 PHP 5.6.9,所以我运行以下 bash:

$ php -r "readfile('https://getcomposer.org/installer');" | php
#!/usr/bin/env php 
All settings correct for using Composer

There are no errors, but it doesn't download. Using SSL or not makes no difference.

没有错误,但它不下载。是否使用 SSL 没有区别。

Using cURL gives the same result:

使用 cURL 给出相同的结果:

$ curl -s https://getcomposer.org/installer | php
#!/usr/bin/env php 
All settings correct for using Composer

I'd be grateful for any troubleshooting suggestions!

如果您提供任何故障排除建议,我将不胜感激!

采纳答案by suncoastkid

To install Composer on Windows IIS 7.5 when installer doesn't work:

要在安装程序不起作用时在 Windows IIS 7.5 上安装 Composer:

  1. Download the .phar file directly under heading "Manual Download" at https://getcomposer.org/download/
  2. Create a directory C:\bin and place the .phar file in it.
  3. In the same directory as the .phar file create another file called composer.bin (Windows batch file) and insert:

    @ECHO OFF

    SET cwd=%cd%

    PUSHD "C:\bin\PHP"

    SET COMPOSER_HOME=C:\bin

    php "C:\bin\composer.phar" -v --working-dir="%cwd%" %*

    POPD

  4. Edit the Windows PATH variable under System Properties -> Environment Variables to include the C:\bin\

  1. 直接在https://getcomposer.org/download/ 的“手动下载”标题下下载 .phar 文件
  2. 创建一个目录 C:\bin 并将 .phar 文件放入其中。
  3. 在与 .phar 文件相同的目录中,创建另一个名为 composer.bin 的文件(Windows 批处理文件)并插入:

    @ECHO 关闭

    设置 cwd=%cd%

    推送“C:\bin\PHP”

    SET COMPOSER_HOME=C:\bin

    php "C:\bin\composer.phar" -v --working-dir="%cwd%" %*

    持久性有机污染物

  4. 在 System Properties -> Environment Variables 下编辑 Windows PATH 变量以包含 C:\bin\