Error while connecting APNS Server - SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL
Error while connecting APNS Server - SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL
我在连接 APNS 和发送推送通知时遇到以下错误。
错误:
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 /filepath/file.php on line 63
Warning: stream_socket_client(): Failed to enable crypto in /filepath/file.php on line 63
Warning: stream_socket_client(): unable to connect to tls://gateway.push.apple.com:2195 (Unknown error) in /filepath/file.php on line 63
我的代码是:
$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
最后,我通过替换
解决了我的问题
$ctx = stream_context_create();
与:
$ctx = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]
]);
我在连接 APNS 和发送推送通知时遇到以下错误。
错误:
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 /filepath/file.php on line 63
Warning: stream_socket_client(): Failed to enable crypto in /filepath/file.php on line 63
Warning: stream_socket_client(): unable to connect to tls://gateway.push.apple.com:2195 (Unknown error) in /filepath/file.php on line 63
我的代码是:
$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
最后,我通过替换
解决了我的问题$ctx = stream_context_create();
与:
$ctx = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]
]);