2

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,

Kara
  • 6,115
  • 16
  • 50
  • 57
Venu V
  • 73
  • 5

2 Answers2

3

There is a better solution than disabling SELinux completely. The problem is that on most SELinux systems (as RedHat, which I am using) HTTPD is not allowed to create network connections.

You can use this command to enable it:

setsebool -P httpd_can_network_connect=1

-P for permanent setting.

I hope it helps, though this thread is accepted

Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107
0

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.

Venu V
  • 73
  • 5