ios,php推送報錯
阿新 • • 發佈:2019-02-04
php已經載入openssl模組,防火牆關閉,報錯如下:
- Warning: stream_socket_client()[function.stream-socket-client]:Unable to setlocal cert chain file `ck.pem'; Check that your cafile/capath settings include details of your certificate and its issuer in /web1/app/testdeom.php on line 31
- Warning: stream_socket_client() [function.stream-socket-client]: failed to create an SSL handle in /web1/app/testdeom.php on line 31
- Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /web1/app/testdeom.php on line 31
- Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /web1/app/testdeom.php on line 31
- Failed to connect: 0
原因:推送證書的問題。
1.確認你的推送證書沒問題嗎?
生成pem步驟:
1.下載下來你配置好的推送證書aps_developer_identity.cer 檔案。
2.轉換 .cer 檔案到 .pem 檔案:
openssl x509 -in aps_developer_identity.cer -inform der
-out PushChatCert.pem
3.在把你“鑰匙”推送證書匯出成的.p12到.pem檔案:
openssl pkcs12 -nocerts -out PushChatKey.pem -in PushChatKey.p12
Enter Import Password:
MAC verified OK
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
4.合併兩個pem檔案:cat PushChatCert.pem PushChatKey.pem > ck.pem
5.測試證書是否可用:
openssl s_client -connect gateway.sandbox.push.apple.com:2195
-cert PushChatCert.pem -key PushChatKey.pem