'Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195'

1,690 views
Skip to first unread message

thornbird

unread,
Sep 29, 2011, 4:09:14 AM9/29/11
to apns-php
I'm trying to make work apns-php on my server

I'm getting this error:

Thu, 29 Sep 2011 10:04:23 +0200 ApnsPHP[3956]: INFO: Trying
ssl://gateway.sandbox.push.apple.com:2195... Thu, 29 Sep 2011 10:04:24
+0200 ApnsPHP[3956]: ERROR: Unable to connect to 'ssl://
gateway.sandbox.push.apple.com:2195': (0) Thu, 29 Sep 2011 10:04:24
+0200 ApnsPHP[3956]: INFO: Retry to connect (1/3)... Thu, 29 Sep 2011
10:04:25 +0200 ApnsPHP[3956]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Thu, 29 Sep 2011 10:04:25 +0200 ApnsPHP[3956]: ERROR: Unable to
connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0) Thu, 29
Sep 2011 10:04:25 +0200 ApnsPHP[3956]: INFO: Retry to connect (2/3)...
Thu, 29 Sep 2011 10:04:26 +0200 ApnsPHP[3956]: INFO: Trying
ssl://gateway.sandbox.push.apple.com:2195... Thu, 29 Sep 2011 10:04:26
+0200 ApnsPHP[3956]: ERROR: Unable to connect to 'ssl://
gateway.sandbox.push.apple.com:2195': (0) Thu, 29 Sep 2011 10:04:26
+0200 ApnsPHP[3956]: INFO: Retry to connect (3/3)... Thu, 29 Sep 2011
10:04:27 +0200 ApnsPHP[3956]: 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 D:\htdocs\test.com\apns-php\ApnsPHP\Abstract.php:360 Stack
trace: #0 D:\htdocs\test.com\apns-php\ApnsPHP\Abstract.php(295):
ApnsPHP_Abstract->_connect() #1 D:\htdocs\test.com\apns-php
\sample_push.php(41): ApnsPHP_Abstract->connect() #2 {main} thrown in
D:\htdocs\test.com\apns-php\ApnsPHP\Abstract.php on line 360

--------------------------------------------------------------------------------------------------------------------
I have found a solution on stackoverflow as below:

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. My doubt is if it will work properly
too on production server. Someone knows?

----------------------------------------------------------------------------------------------------------------------
I wanna know what is the reason? and will it work properly too on
production server?

Aldo Armiento

unread,
Sep 29, 2011, 4:23:44 AM9/29/11
to apns...@googlegroups.com
Il giorno 29/set/2011, alle ore 10.09, thornbird ha scritto:

> I'm trying to make work apns-php on my server
>
> I'm getting this error:
>

> +0200 ApnsPHP[3956]: ERROR: Unable to connect to 'ssl://
> gateway.sandbox.push.apple.com:2195': (0) Thu, 29 Sep 2011 10:04:26

> --------------------------------------------------------------------------------------------------------------------
> I have found a solution on stackoverflow as below:
>
> 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. My doubt is if it will work properly
> too on production server. Someone knows?
>
> ----------------------------------------------------------------------------------------------------------------------
> I wanna know what is the reason? and will it work properly too on
> production server?

Please, don't change Abstract.php but simple don't set in your script:

$push->setRootCertificationAuthority('entrust_root_certification_authority.pem');

Maybe in development server you don't have the file entrust_root_certification_authority.pem (or similar).

You can read some useful informations here: http://code.google.com/p/apns-php/wiki/CertificateCreation#Verify_peer_using_Entrust_Root_Certification_Authority

Aldo

sriniva...@gmail.com

unread,
Aug 26, 2012, 6:09:53 PM8/26/12
to apns...@googlegroups.com
i am still getting this error...i do have the specified certificates as mentioned in http://code.google.com/p/apns-php/wiki/CertificateCreation#Verify_peer_using_Entrust_Root_Certification_Authority

Appreciate if there is any solution to fix this problem...



Mon, 27 Aug 2012 00:07:22 +0200 ApnsPHP[2474]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195... Mon, 27 Aug 2012 00:07:22 +0200 ApnsPHP[2474]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0) Mon, 27 Aug 2012 00:07:22 +0200 ApnsPHP[2474]: INFO: Retry to connect (1/3)... Mon, 27 Aug 2012 00:07:23 +0200 ApnsPHP[2474]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195... Mon, 27 Aug 2012 00:07:23 +0200 ApnsPHP[2474]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0) Mon, 27 Aug 2012 00:07:23 +0200 ApnsPHP[2474]: INFO: Retry to connect (2/3)... Mon, 27 Aug 2012 00:07:24 +0200 ApnsPHP[2474]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195... Mon, 27 Aug 2012 00:07:25 +0200 ApnsPHP[2474]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0) Mon, 27 Aug 2012 00:07:25 +0200 ApnsPHP[2474]: INFO: Retry to connect (3/3)... Mon, 27 Aug 2012 00:07:26 +0200 ApnsPHP[2474]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195... 
 
Reply all
Reply to author
Forward
0 new messages