windows7 安装 composer

之前在mac linux win10 安装运行未发现这样的奇奇怪怪的问题,随手记录下。


 

设置好php命令path 

 

 

 2个位置 administrator告知php安装版本执行文件exe目录,系统告知php.exe。(同一个版本的设置)



F:\dd\exe\composer>php -r "readfile('https://getcomposer.org/installer');" | php

PHP Warning: readfile(): Unable to find the wrapper "https" - did you forget to
enable it when you configured PHP? in Command line code on line 1
PHP Warning: readfile(https://getcomposer.org/installer): failed to open stream
: Invalid argument in Command line code on line 1

Warning: readfile(): Unable to find the wrapper "https" - did you forget to enab
le it when you configured PHP? in Command line code on line 1

Warning: readfile(https://getcomposer.org/installer): failed to open stream: Inv
alid argument in Command line code on line 1

 设置php.ini 打开ssl设置 ;extension=php_openssl.dll

F:\dd\exe\composer>php -r "copy('https://install.phpcomposer.com/installer', 'co
mposer-setup.php');"
PHP Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify faile
d in Command line code on line 1

Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify faile
d in Command line code on line 1
PHP Warning: copy(): Failed to enable crypto in Command line code on line 1

Warning: copy(): Failed to enable crypto in Command line code on line 1
PHP Warning: copy(https://install.phpcomposer.com/installer): failed to open st
ream: operation failed in Command line code on line 1

Warning: copy(https://install.phpcomposer.com/installer): failed to open stream:
operation failed in Command line code on line 1

需要证书 

 

简答方法

浏览器直接地址访问下载

https://getcomposer.org/installer

下载后拉倒php.exe同目录下使用cmd命令

php installer 

php -r "unlink('installer');"

 

或者是下载更新包 

https://install.phpcomposer.com/composer.phar 

下载后php.exe同目录下使用cmd命令 

php composer-setup.php 

php -r "unlink('composer-setup.php');"

或者对着composer文件进行 

@php "%~dp0composer.phar" %*

如果找不到位置就使用 

@php "F:\dd\exe\phpStudy\php70n\composer.phar"

成功后写入bat 

新建 composer.bat 文件  内容写入“@php "%~dp0composer.phar" %*” 保存,用管理员身份运行该文件。

或者cmd执行

echo @php "%~dp0composer.phar" %*>composer.bat

最后 检测是否安装成功

composer -V

 

posted @ 2020-09-17 16:14  小小代  阅读(162)  评论(0编辑  收藏  举报