ApnsPHPを使ってプッシュ通知を実装するとき、下記のエラーが発生しました。
Mon, 09 Jul 2012 13:10:04 +0900 ApnsPHP[85724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Mon, 09 Jul 2012 13:10:05 +0900 ApnsPHP[85724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Mon, 09 Jul 2012 13:10:05 +0900 ApnsPHP[85724]: INFO: Retry to connect (1/3)...
Mon, 09 Jul 2012 13:10:06 +0900 ApnsPHP[85724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Mon, 09 Jul 2012 13:10:06 +0900 ApnsPHP[85724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Mon, 09 Jul 2012 13:10:06 +0900 ApnsPHP[85724]: INFO: Retry to connect (2/3)...
Mon, 09 Jul 2012 13:10:07 +0900 ApnsPHP[85724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Mon, 09 Jul 2012 13:10:07 +0900 ApnsPHP[85724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Mon, 09 Jul 2012 13:10:07 +0900 ApnsPHP[85724]: INFO: Retry to connect (3/3)...
Mon, 09 Jul 2012 13:10:08 +0900 ApnsPHP[85724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
いろいろ悩んだ結果、下記ページに載った方法で解決しました:
http://stackoverflow.com/questions/6279185/apnsphp-cant-connect-to-apple-gateway
→ 簡単にまとめますと、結局、ライブラリを1箇所修正した方向で行きました:
Abstract.phpの343行目の近くの「’verify_peer’ => isset($this->_sRootCertificationAuthorityFile),」をコメントアウトしました。
'verify_peer' => isset($this->_sRootCertificationAuthorityFile),
→
// 'verify_peer' => isset($this->_sRootCertificationAuthorityFile),
でも、やはり危なく感じていますので、何か良い解決策があったら教えていただければと思います。