【发布时间】:2020-05-12 22:02:18
【问题描述】:
我在连接 APNS 并发送推送通知时遇到以下错误。
错误:
警告:stream_socket_client(): SSL 操作失败,代码为 1。OpenSSL 错误消息:错误:14090086:SSL 例程:ssl3_get_server_certificate:certificate verify failed in /filepath/file.php on line 63
警告:stream_socket_client():无法在第 63 行的 /filepath/file.php 中启用加密
警告:stream_socket_client(): 无法连接到第 63 行 /filepath/file.php 中的 tls://gateway.push.apple.com:2195(未知错误)
我的代码是:
$ctx = stream_context_create();
tream_context_set_option($ctx, 'ssl', 'local_cert', $pemfile);
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
$fp = stream_socket_client(
'ssl://gateway.push.apple.com:2195',
$err,
$errstr,
60,
STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT,
$ctx
);
似乎 .pem 文件 ($pemfile) 没有通过 SSL 连接。
我使用的是 PHP 版本 7.2.8
【问题讨论】:
-
tream_context_set_option()???缺少s
标签: php ssl push-notification apple-push-notifications stream-socket-client