gpt4 book ai didi

PHP Composer - 无法在 macOS Sierra 上安装 Composer

转载 作者:可可西里 更新时间:2023-10-31 23:02:16 25 4
gpt4 key购买 nike

我正在尝试安装 composer,运行 getcomposer.org/download 文档站点上提供的命令:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

但我收到一条错误消息:

Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in Command line code on line 1

Warning: copy(): Failed to enable crypto in Command line code on line 1

Warning: copy(https://getcomposer.org/installer): failed to open stream: operation failed in Command line code on line 1
Yoshihiros-MacBook-Pro:~ yoshihiro$ php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

Warning: hash_file(composer-setup.php): failed to open stream: No such file or directory in Command line code on line 1
Installer corrupt
Warning: unlink(composer-setup.php): No such file or directory in Command line code on line 1

Yoshihiros-MacBook-Pro:~ yoshihiro$ php composer-setup.php
Could not open input file: composer-setup.php

我也在尝试全局安装它,但我无法摆脱这条消息。 请帮助D:

最佳答案

我遇到了同样的问题,但这是我所做的:

  • 我将其复制粘贴到终端 php -r "copy('http://getcomposer.org/installer', 'composer-setup.php');" 在下载的终端上 Composer 到您当前所在的目录。

(the problem was causing because of the https protocol)

  • 然后php composer-setup.php --install-dir=/usr/local/bin --filename=composer 运行此命令,它将 Composer 安装到我的 bin 文件夹中,以便我可以在全局范围内运行它。

  • 然后你必须取消链接 composer php -r "unlink('composer-setup.php');"

  • 最后检查安装的 Composer composer -V

祝你好运!

关于PHP Composer - 无法在 macOS Sierra 上安装 Composer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40205623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com