push-notificationapple-push-notificationsapns-php

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


I am facing issue with APNS php code for push notification on IOS devices, I have two separate connection for Development and Production.

  1. I have configure the development connection on my server by adding the .pem file certificate and Passphares its working perfect and I received the notification also. Have a look my development configuration:

Url: 'ssl://gateway.sandbox.push.apple.com:2195'

$push = new ApnsPHP_Push(
    ApnsPHP_Abstract::ENVIRONMENT_SANDBOX,
    'APNS_Dev_ISAS.pem'
);
$myNewLogger = new MyNewLogger();
$push->setLogger($myNewLogger);

// Set the Provider Certificate passphrase
$push->setProviderCertificatePassphrase('1234567');

$push->setRootCertificationAuthority('APNS_Dev_ISAS.pem');
$push->connect();

Issue:

  1. Than I configured the connection for Production by adding following parameters but I getting the connection error:

Url: ssl://gateway.push.apple.com:2195

$push = new ApnsPHP_Push(
    ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION,
    'APNS_PROD_ISAS.pem'
);
$myNewLogger = new MyNewLogger();
$push->setLogger($myNewLogger);

// Set the Provider Certificate passphrase
$push->setProviderCertificatePassphrase('12345678');

$push->setRootCertificationAuthority('APNS_PROD_ISAS.pem');
$push->connect();

Error of connection: INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0) INFO: Retry to connect (1/3)...INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0) INFO: Retry to connect (2/3)... INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0) INFO: Retry to connect (3/3)... INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0)

I google the issue and I found the some solutions and I have check all and everything is fine but no success.

Any help will be appreciated really. Thanks in advance.


Solution

  • Certificate (.pem) having issue that I was created for push notification.

    Solution: After few days trying on same issue I found that create certificate with mini character passpharess may be 1234, It will work perfect for you and make successful connection to IOS push notification server.

    May be this will help someone else.

    Thanks.