ApnsPHP 无法连接到 Apple 网关
今天突然出现一个非常奇怪的错误,说它无法连接到适当的网关......有什么修复建议吗?
这是记录器输出:
Wed, 08 Jun 2011 15:05:44 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:45 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Wed, 08 Jun 2011 15:05:45 +0200 ApnsPHP[21724]: INFO: Retry to connect (1/3)...
Wed, 08 Jun 2011 15:05:46 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:47 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Wed, 08 Jun 2011 15:05:47 +0200 ApnsPHP[21724]: INFO: Retry to connect (2/3)...
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: INFO: Retry to connect (3/3)...
Wed, 08 Jun 2011 15:05:49 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Fatal error: Uncaught exception 'ApnsPHP_Exception' with message 'Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)' in /home/xxxx/xxxxx/ApnsPHP/Abstract.php:354
suddenly a really strange error appeared today, saying that it isn't able to connect to the appropriate gateway...any fix suggestions?
Here's the logger output:
Wed, 08 Jun 2011 15:05:44 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:45 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Wed, 08 Jun 2011 15:05:45 +0200 ApnsPHP[21724]: INFO: Retry to connect (1/3)...
Wed, 08 Jun 2011 15:05:46 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:47 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Wed, 08 Jun 2011 15:05:47 +0200 ApnsPHP[21724]: INFO: Retry to connect (2/3)...
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: INFO: Retry to connect (3/3)...
Wed, 08 Jun 2011 15:05:49 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Fatal error: Uncaught exception 'ApnsPHP_Exception' with message 'Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)' in /home/xxxx/xxxxx/ApnsPHP/Abstract.php:354
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
这个解决方案对我有用。原始答案位于 推送通知服务器实现 -
我找到了解决方案,但没有知道这是否是最好的,但它确实有效。在 Abstract.php (该文件是 apns-php 源代码的一部分)上,我评论了第 343 行。现在它看起来像这样:
我真的不知道这一行的意义是什么,但知道推送通知正在工作适当地。
This solution worked for me. The original answer is on Push notifications server implementation -
I have found a solution, I don't know if it's the best, but it works. On Abstract.php (this file is part of the apns-php source) I have commented the line 343. Now it looks like this:
I really don't know what is the point of this line, but know the push notification is working properly.
我的情况是我更改第 58 行和第 59 行文件 ApnsPHP/Push.php
这
<代码>
受保护的 $_aServiceURLs = 数组(
'ssl://gateway.push.apple.com:2195', // 生产环境
'ssl://gateway.sandbox.push.apple.com:2195' // 沙盒环境
); /<强>< @type array 服务 URL 环境。 */
和
<代码>
受保护的 $_aServiceURLs = 数组(
'gateway.push.apple.com:2195', // 生产环境
'gateway.sandbox.push.apple.com:2195' // 沙箱环境
); /
< @type array 服务 URL 环境。 */
im my case i change line 58 and 59 File ApnsPHP/Push.php
This
protected $_aServiceURLs = array(
'ssl://gateway.push.apple.com:2195', // Production environment
'ssl://gateway.sandbox.push.apple.com:2195' // Sandbox environment
); /< @type array Service URLs environments. */
With
protected $_aServiceURLs = array(
'gateway.push.apple.com:2195', // Production environment
'gateway.sandbox.push.apple.com:2195' // Sandbox environment
); /
< @type array Service URLs environments. */
您可以检查是否安装了正确的证书。查看此网址:https://code.google.com/p/apns- php/wiki/CertificateCreation 生成“entrust_root_certification_authority.pem”文件。
您可以通过在sample_push.php 上注释以下行来跳过证书验证:
希望它有帮助。问候。
You might check you have the right certificates installed. Look into this URL: https://code.google.com/p/apns-php/wiki/CertificateCreation to generate 'entrust_root_certification_authority.pem' file.
You can skip the certificate validation by commenting the following line on sample_push.php:
Hope that it helps. Regards.
请检查苹果文档中指定的端口。
您必须打开提供商端系统上的端口。
Please check with ports specified in apple doc.
You have to open the ports on your provider side system.
我遇到了同样的错误。我用谷歌搜索了很多并遵循本指南的每一步,确保我的 pem 文件正确生成:
https://code.google.com/p/apns-php/wiki/CertificateCreation
然后我运行下面的命令来检查 apns 的安全链接是否正确:
按 Enter 键,我收到此提示:
然后我意识到我忘记了为证书设置密码(在我的情况下是 dev.pem)
为 apns pem 设置正确的密码,问题解决。
I got the same error. I google a lot and follow every step of this guide, make sure my pem file is generated rightly:
https://code.google.com/p/apns-php/wiki/CertificateCreation
then i run below command to check is the secure link to apns right or not:
Press enter and i got this prompt :
then i realize that i forgot set passphrase for cert(it is dev.pem in my case)
set the right passphrase for the apns pem, problem solved.
我遇到了同样的问题,我做错的是为 SSL 客户端身份验证和根 CA 提供相同的证书,下面的代码对我有用
https://code.google.com/p/apns-php/wiki/CertificateCreation
I had same issue and what I did wrong was providing same certificate for SSL client authentication and the root CA, below code worked for me
https://code.google.com/p/apns-php/wiki/CertificateCreation
开发者需要以不同的方式导出 APNS 证书及其密钥。如果同时导出两者,则会出现此错误。
Developer need to export APNS certificate and its key differently. If both are exported in one go then this error will arise.