bubifengyun 2015-06-25 21:31:07 26615次浏览 1条评论 0 2 0

测试环境

Deepin 2014.3 64bit,linux下的xamppp

问题

Changed current directory to /home/888/.composer
./composer.json has been updated
Loading composer repositories with package information
The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failedhttps://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of dateUpdating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

看问题是SSL的验证问题,网上搜索了很久没有解决.

下面是来自某被墙的网页的快照。没办法,贴网址也无效。

经过原因查找,在验证证书的时候出现问题,是本地ssl判别证书太旧,导致报ssl证书错误

解决方案

解决方案一、

更换 xampp的版本。

下载新的ssl本地判别文件

wget http://curl.haxx.se/ca/cacert.pem

并更名为ca-bundle.crt放置到默认目录。如果该目录不存在可以创建。

 mv cacert.pem ca-bundle.crt  | mv ca-bundle.crt /etc/pki/tls/certs/

或者curl –cacert cacert.pem 方式指定调用

然后无意中更改了一下xampp-linux-x64-5.6.8-0-installer.run为一个老的版本xampp-linux-x64-1.8.3-5-installer.run,竟然可以使用了,你不妨换换版本的。

我在deepin2014.3,64bit操作系统下测试成功解决该error.

解决方案二【推荐】

推荐理由

  • 下载速度提升
  • 解决问题
  • 这个是借用镜像,可以下载部分被墙的代码

借鉴 这里 。感谢分享。

版本太老,不建议用这个。
修改~/.composer/config.json,添加

{
    "repositories": [
        {"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"},
        {"packagist": false}
    ]}

最终是这样子的。

{
    "config": {

    },
    "repositories": [
        {"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"},
        {"packagist": false}
    ]}

最终测试可以使用。

解决方案三[完美解决]

参考:https://github.com/composer/composer/issues/3346

First:

Check certificate file location which will be in default_cert_file key, you will found it in openssl_get_cert_locations() its php openssl function:
第一步:需找验证钥匙的地址,使用 php函数openssl_get_cert_locations().

$ php -r "print_r(openssl_get_cert_locations());"
Array
(
    [default_cert_file] => /opt/lampp/share/openssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /opt/lampp/share/openssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /opt/lampp/share/openssl/private
    [default_default_cert_area] => /opt/lampp/share/openssl
    [ini_cafile] => 
    [ini_capath] => 
)

Second:

Download http://curl.haxx.se/ca/cacert.pem:
第二步:下载最新的cacert.pem,从上面这个网址下。

$ wget http://curl.haxx.se/ca/cacert.pem

Third:

Copy certificate PEM file into default_cert_file location:
第三步:建立openssl到默认cert文件到连接。

$ sudo mv cacert.pem /opt/lampp/share/openssl/cert.pem

My php-cli is under XAMPP and default_cert_file maybe point to some place that is different than this.
注意:这个要跟上面第一步找到到地址一致。

Fourth:

Restart xampp:
重启xampp

$ sudo /opt/lampp/xampp restart

I hope anything after that should goes fine with you brothers.
希望你顺利解决。

原文: http://my.oschina.net/bubifengyun/blog/469277

觉得很赞
您需要登录后才可以评论。登录 | 立即注册