I am facing issue with APNS php code for push notification on IOS devices, I have two separate connection for Development and Production.
- 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:
- 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.
- I have used the correct path for development and production.
- I have created the separate certificate .pem files for both and tested the certificate on pusher app. Certificate are correct.
- Port is also fine and no blocking from my server because same port is used in development url and development server push notification working fine.
Any help will be appreciated really. Thanks in advance.