`

SSL certificate verification on PHP 5.6

 
阅读更多

SSL certificate verification on PHP 5.6

I recently updated my local OS X Zend Server installation to PHP 5.6 and when I ran composer self-update, I got this error message:

[Composer\Downloader\TransportException]                                                                                       
The "https://getcomposer.org/version" 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 failed 

Googling around, I finally worked out that there have been various SSL improvements in PHP 5.6 and that the problem was that it couldn't find any OpenSSL certificates on my system. This isn't a total surprise as OS X has been moving away from using OpenSSL internally in favour of its own libraries.

There's a new PHP function openssl_get_cert_locations that helps with this and so I ran:

$ php -r "print_r(openssl_get_cert_locations());"

on the command line to find out where PHP was looking. On my system, I got this:

Array
(
    [default_cert_file] => /usr/local/openssl-0.9.8zb/ssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /usr/local/openssl-0.9.8zb/ssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /usr/local/openssl-0.9.8zb/ssl/private
    [default_default_cert_area] => /usr/local/openssl-0.9.8zb/ssl
    [ini_cafile] => 
    [ini_capath] => 
)

There is no directory /usr/local/openssl-0.9.8zb on my system and SSL_CERT_FILE and SSL_CERT_DIR are not defined, so it's no surprise that PHP was struggling.

To fix it, I install openssl via homebrew:

brew install openssl

This installs the openssl certificates to /usr/local/etc/openssl/cert.pem, so we can now use the new PHP 5.6 INI setting openssl.cafile to tell PHP where to find the certificates:

Adding

openssl.cafile=/usr/local/etc/openssl/cert.pem

to Zend Server's php.ini solved the problem and I can now use composer once again!

分享到:
评论

相关推荐

    omniauth: Server certificate verification

    综上所述,解决“omniauth: Server certificate verification”问题通常需要理解SSL/TLS证书的工作原理,检查配置,更新信任的CA证书,以及可能的代码调整。同时,利用`ca-bundle.crt`这样的证书集合文件,可以增强...

    实现Linux系统的SSL安全代理.pdf

    "实现Linux系统的SSL安全代理" 一、SSL安全协议简介 SSL(Secure Sockets Layer,安全套接字层)协议是Internet上进行信息发布和电子商务活动所使用的主要安全通信协议之一,也是Web传输中使用最广泛的实现密码学...

    Certificate Verification Failed(解决方案).md

    Certificate Verification Failed(解决方案).md

    Certificate verification failed(解决方案).md

    Certificate verification failed(解决方案).md

    Eko certificate verification-crx插件

    Eko certificate verification-crx插件的工作原理是,在用户访问一个网站时,它会自动检查该网站的SSL/TLS证书,包括证书的颁发者、有效期、指纹等关键信息。如果证书存在任何问题,如过期、未被信任或者与预期不符...

    http远程接口调用-httpClient+跳过SSL证书校验

    public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { return true; } }).build(); // 创建忽略主机名验证的hostnameVerifier HostnameVerifier ...

    Java如何跳过https的ssl证书验证详解

    SSL证书只是数字证书的一种,CA机构签发SSL证书。CA是数字证书管理机构。从理论上来说,如果服务端采用HTTPS协议,而自己没有SSL证书(服务端不提供SSL证书),那么通信是不可能成功的。 三、Java跳过HTTPS的SSL...

    使用php语言实现verification——code 功能

    使用php语言实现verification——code 功能

    coursera machine learning利用 octave提交作业

    在本资源中,我们主要关注的是如何在Coursera上的吴恩达机器学习课程中,使用Octave 4.0.0版本成功提交作业。吴恩达的这门课程是机器学习领域的经典入门课程,涵盖了广泛的理论知识和实践技能。...

    MySQL 5.6 Reference Manual

    Table of Contents Preface, Notes, Licenses . . . . . . . . ....1. Licenses for Third-Party Components ....1.1. FindGTest.cmake License ....1.2. LPeg Library License ....1.3. LuaFileSystem Library License ....

    jenkins发版报错Host key verification failed

    jenkins发版报错Host key verification failed. jenkins发版报错Host key verification failed. jenkins发版报错Host key verification failed. jenkins发版报错Host key verification failed. jenkins发版报错Host ...

    页面最效果Verification.html

    在给定的标题"页面最效果Verification.html"中,我们可以理解这是一个关于网页更新的项目,重点是验证(Verification)页面的新效果。描述指出,新页面名为"Verification.html",在页面头部增加了一个链接入口,并且...

    Systemverilog for Verification

    SystemVerilog for Verification teaches the reader how to use ... SystemVerilog for Verification concentrates on the best practices for verifying your design using the power of the language.  

    aws-cf-verified-ssl-certificate:Cloudformation模板以获取经过验证的SSL证书

    目前,很难通过CloudFormation从AWS Certificate Manager自动检索经过验证的SSL / TLS证书,因为您至少需要在一个超级域上拥有一个管理员电子邮件地址。 此处提供的解决方案通过管理与CloudFormation不友好的SES相关...

    Certificate Verification System:CVS 旨在帮助雇主确保学位是否伪造。-开源

    证书验证系统旨在帮助阿富汗和卢旺达的雇主在招聘员工时无法检查文件的真实性,以确保给定的证书或学位是由真正知名的大学或学院颁发的。 该在线系统将仅使用一次性密码以更好地保护应用程序。

Global site tag (gtag.js) - Google Analytics