报错提示: The “https://getcomposer.org/versions” file could not be downloaded: failed to open stream:

  • Post author:
  • Post category:其他


报错提示:

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目录下的ssleay32.dll,libeay32.dll以及php/ext文件夹下的:php_openssl.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”

5、重启phpStudy就可以了

报错提示:


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)”)

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

3、开启之后重启重启phpStudy就可以了

PS:  openssl.cafile 配置选项, 是 PHP 5.6.0. 以上的版本才支持的

———————

作者:从别后

来源:CSDN

原文:https://blog.csdn.net/cs958903980/article/details/52023727

版权声明:本文为博主原创文章,转载请附上博文链接!