Push notifications server implementation(推送通知服务器实现)
问题描述
我正在尝试在我的服务器上运行 apns-php (http://code.google.com/p/apns-php/)(Bluehost 具有专用 IP 和端口 2195,为 tcp 和 udp 传出打开).
I'm trying to make work apns-php (http://code.google.com/p/apns-php/) on my server (Bluehost with dedicated IP and port 2195 open for tcp and udp outgoing).
我收到此错误:
致命错误:未捕获的异常带有消息的ApnsPHP_Exception"'无法连接到'ssl://gateway.sandbox.push.apple.com:2195':(0)' 中/home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php:352堆栈跟踪:#0/home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php(295):ApnsPHP_Abstract->_connect() #1/home2/xxxxx/public_html/xxxxx/pns/sample_push.php(41):ApnsPHP_Abstract->connect() #2 {main}扔进去/home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php在线 352
Fatal error: Uncaught exception 'ApnsPHP_Exception' with message 'Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)' in /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php:352 Stack trace: #0 /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php(295): ApnsPHP_Abstract->_connect() #1 /home2/xxxxx/public_html/xxxxx/pns/sample_push.php(41): ApnsPHP_Abstract->connect() #2 {main} thrown in /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php on line 352
我联系了 Bluehost 支持,他们告诉我:
I have contact Bluehost support and they told me this:
感谢您与我们联系.如果看起来像虽然服务器ssl://gateway.sandbox.push.apple.com:2195*拒绝接受连接由您的帐户制作.有没有办法您可以将您的专用 IP 列入白名单或接受他们的传入连接结束?
Thanks for contacting us. If seems as though the server ssl://gateway.sandbox.push.apple.com:2195* is refusing to accept the connection made from your account. Is there a way you can whitelist your dedicated ip or accept incoming connections on their end?
有人可以帮我解决这个问题吗?有任何想法吗?谢谢!
Someone can help me to solve this out? Any ideas? Thanks!
推荐答案
我找到了一个解决方案,我不知道它是否是最好的,但它有效.在 Abstract.php(该文件是 apns-php 源代码的一部分)上,我注释了第 343 行.现在它看起来像这样:
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:
$streamContext = stream_context_create(array('ssl' => array(
//'verify_peer' => isset($this->_sRootCertificationAuthorityFile),
'cafile' => $this->_sRootCertificationAuthorityFile,
'local_cert' => $this->_sProviderCertificateFile
)));
我真的不知道这条线有什么意义,但知道推送通知工作正常.我怀疑它是否也能在生产服务器上正常工作.有人知道吗?
I really don't know what is the point of this line, but know the push notification is working properly. My doubt is if it will work properly too on production server. Someone knows?
这篇关于推送通知服务器实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:推送通知服务器实现
基础教程推荐
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- HTTP 与 FTP 上传 2021-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- 使用 PDO 转义列名 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01