phpStudy集成环境下 安装composer

报错提示:

  1. The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。  
  2. The "https://getcomposer.org/download/1.2.0/composer.phar.sig" file could not be downloaded: SSL: crypto enabling timeout  
  3. Failed to enable crypto  
  4. failed to open stream: operation failed

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

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

3、openssl需要CA证书 phpstudy也是没有的 CA证书下载地址:http://curl.haxx.se/docs/caextract.html 选中之后单击右键选择另存为 下载成功之后放到tmp文件夹下面

4、然后修改php.ini文件

openssl.cafile = "D:phpStudy	mpcacert.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就可以了

原文地址:https://www.cnblogs.com/-mrl/p/6428816.html