服务器脚本中的 APN 错误 [英] APN Error in Server Script

查看:24
本文介绍了服务器脚本中的 APN 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 php 脚本中收到此错误,同时发送有效负载数据.

I am getting this error in my php script , while sending payload data.

Warning: stream_socket_client() [function.stream-socket-client]:
Unable to set private key file `/Applications/XAMPP/xamppfiles/htdocs/test/apn/apns-dev.pem'
in /Applications/XAMPP/xamppfiles/htdocs/test/apn/push.php on line 42

Warning: stream_socket_client() [function.stream-socket-client]:
failed to create an SSL handle
in /Applications/XAMPP/xamppfiles/htdocs/test/apn/push.php on line 42

Warning: stream_socket_client() [function.stream-socket-client]:
Failed to enable crypto
in /Applications/XAMPP/xamppfiles/htdocs/test/apn/push.php on line 42

Warning: stream_socket_client() [function.stream-socket-client]:
unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error)
in /Applications/XAMPP/xamppfiles/htdocs/test/apn/push.php on line 42

是什么原因?我需要更改任何设置吗?我也在服务器中安装了 .pem 文件.

What is the reason ? Do I need to change any settings? I have also installed the .pem file in the server.

谢谢

推荐答案

你能把你用来连接 APN 的 PHP 代码 (push.php) 贴出来吗?

Can you post the PHP code (push.php) you're using to connect to APN?

黑暗中的一些镜头:
- 证书和私钥都在那个 .pem 文件中吗?
- 您是从私钥文件中删除了密码,还是在 PHP 代码中正确设置了密码?
- 运行您的脚本的用户是否具有访问/读取证书/密钥文件的适当 unix 权限?
- 你能从你的机器上访问 Apple 的服务器吗?您可以通过运行 telnet 进行测试.

Some shots in the dark:
- Are both the certificate and private key in that one .pem file?
- Did you remove the password from the private key file, or are you setting it properly in your PHP code?
- Does the user running your script have the proper unix permissions to access/read the cert/key file?
- Can you access Apple's server from your machine? You can test by running telnet.

telnet gateway.sandbox.push.apple.com 2195

这篇关于服务器脚本中的 APN 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆