Push notification 无法连接到live';ssl://gateway.push.apple.com:2195'
我面临着在IOS设备上用于推送通知的APNS php代码的问题,我有两个独立的开发和生产连接Push notification 无法连接到live';ssl://gateway.push.apple.com:2195',push-notification,apple-push-notifications,apns-php,Push Notification,Apple Push Notifications,Apns Php,我面临着在IOS设备上用于推送通知的APNS php代码的问题,我有两个独立的开发和生产连接 我已经在我的服务器上配置了开发连接,添加了.pem文件证书和Passphares,它工作正常,我也收到了通知。查看我的开发配置: Url:'ssl://gateway.sandbox.push.apple.com:2195“ $push = new ApnsPHP_Push( ApnsPHP_Abstract::ENVIRONMENT_SANDBOX, 'APNS_Dev_ISAS.pe
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_SANDBOX,
'APNS_Dev_ISAS.pem'
);
$myNewLogger = new MyNewLogger();
$push->setLogger($myNewLogger);
// Set the Provider Certificate passphrase
$push->setProviderCertificatePassphrase('1234567');
$push->setRootCertificationAuthority('APNS_Dev_ISAS.pem');
$push->connect();
问题:
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION,
'APNS_PROD_ISAS.pem'
);
$myNewLogger = new MyNewLogger();
$push->setLogger($myNewLogger);
// Set the Provider Certificate passphrase
$push->setProviderCertificatePassphrase('12345678');
$push->setRootCertificationAuthority('APNS_PROD_ISAS.pem');
$push->connect();
连接错误:
信息:正在尝试ssl://gateway.push.apple.com:2195...ERROR: 无法连接到'ssl://gateway.push.apple.com:2195': (0)
信息:重试连接(1/3)…信息:正在尝试ssl://gateway.push.apple.com:2195...ERROR: 无法连接到'ssl://gateway.push.apple.com:2195': (0)
信息:重试连接(2/3)。。。
信息:正在尝试ssl://gateway.push.apple.com:2195...ERROR: 无法连接到'ssl://gateway.push.apple.com:2195': (0)
信息:重试连接(3/3)。。。
信息:正在尝试ssl://gateway.push.apple.com:2195...ERROR: 无法连接到'ssl://gateway.push.apple.com:2195':(0)
我搜索了这个问题,找到了一些解决方案,我检查了所有的问题,一切都很好,但没有成功
- 我使用了正确的开发和生产路径
- 我已经为两者创建了单独的certificate.pem文件,并在pusher应用程序上测试了证书。证书是正确的
- 端口也很好,我的服务器没有阻塞,因为在开发url和开发服务器推送通知中使用了相同的端口,工作正常
谢谢。我在执行PHP脚本时遇到了同样的问题。经过一些研究,我对这三个密钥对值“cafile”、“CN_match”和“ciphers”进行了注释 然后它开始正常工作。我希望这个答复对其他人也有用
$contextOptions = array(
'ssl' => array(
'verify_peer' => false, // You could skip all of the trouble by changing this to false, but it's WAY uncool for security reasons.
// 'cafile' => 'NiteVisionWebPushFile.pem',
// 'CN_match' => 'gateway.push.apple.com', // Change this to your certificates Common Name (or just comment this line out if not needed)
// 'ciphers' => 'HIGH:!SSLv2:!SSLv3',
'disable_compression' => true,
));
天哪。。。。。。我被困了大约8个小时,直到我找到这个答案。。。。我爱你,救了我很多时间。。。。我想知道当一个复杂的密码短语无法连接时,原因是否是因为它试图像ejabberd(像任何其他XMPP套接字一样)那样与APNS服务器进行4路握手,因此如果SHA解密/加密所用的时间超过超时限制,那么它就无法连接。。。。我wonder@lffi,在我的例子中,我从另一台生成.csr文件的机器上获得了.p12文件。现在,我已经生成了密码为1234的.pem文件,但在创建VOIP测试连接时,它仍然给了我相同的错误。警告:流\u套接字\u客户端():无法连接到ssl://gateway.sandbox.push.apple.com:2195 (php_network_getaddresses:getaddrinfo失败:提供了nodename或servname,或未知)是我用来在线测试的。有什么建议我遗漏了什么吗?@CoDe bro,我也有同样的情况,你找到解决办法了吗?请让我知道,我是用这种方法修好的。使用“$openssl pkcs12-in cert.p12-out pushcert.pem-nodes-clcerts”命令生成pem。虽然它要求“passpharess”,但我没有给出任何“passpharess”,只是点击回车键。和testd使用“”。希望它能帮助别人。@kalpa你救了我一天。非常感谢你!