在 IIS 7.5 上安装 Composer

Installing Composer on IIS 7.5

我正在尝试在 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 5.6.9,所以我 运行 以下 bash:

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

没有错误,但没有下载。使用或不使用 SSL 没有区别。

使用 cURL 得到相同的结果:

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

如果有任何疑难解答建议,我将不胜感激!

在安装程序无法运行时在 Windows IIS 7.5 上安装 Composer:

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

    @ECHO 关闭

    SET cwd=%cd%

    PUSHD"C:\bin\PHP"

    SET COMPOSER_HOME=C:\bin

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

    POPD

  5. 编辑系统属性下的 Windows PATH 变量 -> 环境变量包括 C:\bin\