Search code examples
apple-push-notificationsapns-php

Apple apns 'Permission denied' issue


I am facing an issue while sending request to server for push notification. While trying to connect to apple server we are getting the following response,

ApnsPHP[15748]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195... Tue, 15 Jan 2013 08:20:28 +0100 ApnsPHP[15748]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': Permission denied (13)

We checked the server settings and the server is not blocking any out going requests. We created the p12 certificate as per the guidelines by apple, and we are converting it to .pem by executing following shell command in the server.

openssl pkcs12 -in HSPushNopassword.p12  -out HSPushNopassword.pem  -nodes -clcerts

And the same code and certificate is working fine in another server.

Please let me know why we are getting this error? Thanks,


Solution

  • I sorted it out. Yes, the problem was the server, but it was likely due to when they had root and reloaded things. In a nutshell, there is a very restrictive security system called 'selinux'. So I disabled that, and set the config so it stays off after reboot. And the push notification is working fine now.