suddenly a really strange error appeared today, saying that it isn't able to connect to the appropriate gateway...any fix suggestions?
Here's the logger output:
Wed, 08 Jun 2011 15:05:44 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:45 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Wed, 08 Jun 2011 15:05:45 +0200 ApnsPHP[21724]: INFO: Retry to connect (1/3)...
Wed, 08 Jun 2011 15:05:46 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:47 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Wed, 08 Jun 2011 15:05:47 +0200 ApnsPHP[21724]: INFO: Retry to connect (2/3)...
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: INFO: Retry to connect (3/3)...
Wed, 08 Jun 2011 15:05:49 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Fatal error: Uncaught exception 'ApnsPHP_Exception' with message 'Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)' in /home/xxxx/xxxxx/ApnsPHP/Abstract.php:354
This solution worked for me. The original answer is on Push notifications server implementation -
I have found a solution, I don't know if it's the best, but it works. On Abstract.php (this file is part of the apns-php source) I have commented the line 343. Now it looks like this:
$streamContext = stream_context_create(array('ssl' => array(
//'verify_peer' => isset($this->_sRootCertificationAuthorityFile),
'cafile' => $this->_sRootCertificationAuthorityFile,
'local_cert' => $this->_sProviderCertificateFile
)));
I really don't know what is the point of this line, but know the push notification is working properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With