微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PHP ios推送nofitcation错误:stream_socket_client():SSL操作失败,代码为1

我已经阅读了关于这个问题的所有其他帖子,但仍无济于事.

我知道这个问题可能会出现错误的证书,但我确认我的证书和我的密钥都是有效的,然后将它们合并到我放在服务器上的单个.pem文件中.

我完全不知道如何解决这个问题,所以非常感谢任何和所有的建议.这是我的服务器代码

$ctx = stream_context_create();
        stream_context_set_option($ctx,'ssl','local_cert','ck.pem');
        stream_context_set_option($ctx,'passphrase',$passphrase);

        // Open a connection to the APNS server
        $fp = stream_socket_client('ssl://gateway.sandBox.push.apple.com:2195',$err,$errstr,60,STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT,$ctx);

附: ck.pem文件位于同一目录中,并设置了读取权限.

这是完整的错误消息:

Warning: stream_socket_client(): SSL operation Failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify Failed in /var/www/site/pages/Callback.PHP on line 3515 Warning: stream_socket_client(): Failed to enable crypto in /var/www/site/pages/Callback.PHP on line 3515 Warning: stream_socket_client(): unable to connect to ssl://gateway.sandBox.push.apple.com:2195 (UnkNown error) in /var/www/site/pages/Callback.PHP on line 3515 Failed to connect BECUSE OF ERROR: 0
UPDATE
It does seem to be a certificate validation issue after all but Im not sure why,when I check the ssl against APNS I get this error:
depth=1 /C=US/O=entrust,Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 entrust,Inc./CN=entrust Certification Authority - L1C
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/C=US/ST=California/L=Cupertino/O=Apple Inc./OU=iTMS Engineering/CN=gateway.sandBox.push.apple.com
   i:/C=US/O=entrust,Inc./CN=entrust Certification Authority - L1C
 1 s:/C=US/O=entrust,Inc./CN=entrust Certification Authority - L1C
   i:/O=entrust.net/OU=www.entrust.net/cps_2048 incorp. by ref. (limits liab.)/OU=(c) 1999 entrust.net Limited/CN=entrust.net Certification Authority (2048)
---
No client certificate CA names sent
下载entrust_2048_ca.cer

添加完整路径到entrust_2048_ca.cer

/var/www/site/pages/entrust_2048_ca.cer

原文地址:https://www.jb51.cc/php/137401.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐