composer问题

技术库 小李 1696浏览

一、phpStudy集成环境下 安装composer失败

  • composer self-update报错误

 

The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。  

The "https://getcomposer.org/download/1.2.0/composer.phar.sig" file could not be downloaded: SSL: crypto enabling timeout  

Failed to enable crypto  

failed to open stream: operation failed

解决:

1、安装composer需要开启openssl拓展 而phpstudy默认是关闭的

2、将PHP/ext文件夹下的: php_openssl.dll, ssleay32.dll, libeay32.dll 3个文件拷贝到WINDOWS\system32 文件夹下。

3、openssl需要CA证书 phpstudy也是没有的

 CA证书下载地址:http://curl.haxx.se/docs/caextract.html

 选中之后单击右键选择另存为

 下载成功之后放到tmp文件夹下面

4、然后修改php.ini文件

openssl.cafile = "D:\phpStudy\tmp\cacert.pem"  

 

  • 报错误:
[Composer\Downloader\TransportException]
 The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: HTTP request failed!

 

解决:

1、检查一下php的curl拓展是否开启

2、检查这两个配置是否开启。

allow_url_fopen = On  

user_agent="PHP"  

也可以这样配置 user_agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)”)

模拟浏览器访问也是一个不错的选择

 

 

转载请注明:清韵逸-博客生活分享 » composer问题