Apple推送通知服务:证书安装服务器端? [英] Apple Push Notification Service: Certificate Install Server Side?

查看:286
本文介绍了Apple推送通知服务:证书安装服务器端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照如何构建Apple Push Notification提供程序服务器(教程),以尝试设置推送通知服务器。



当我尝试连接下面的PHP代码

  //连接到apns服务器
$ strAPNSUrl ='ssl ://gateway.sandbox.push.apple.com:2195';
$ strAPNSCert ='dev.pem';

//生成流
$ oStreamContext = stream_context_create();
stream_context_set_option($ oStreamContext,'ssl','local_cert',$ strAPNSCert);

//创建套接字连接
$ oAPNS = stream_socket_client($ strAPNSUrl,$ iError,$ strError,2,STREAM_CLIENT_CONNECT,$ oStreamContext);

我收到以下警告



code>
警告:stream_socket_client()[function.stream-socket-client]:SSL操作失败,代码为1. OpenSSL错误消息:错误:14094410:SSL例程:SSL3_READ_BYTES:sslv3 alert



根据我在Google上可以找到的资讯,问题似乎是我的凭证。



我在OS X中生成我的csr和pem文件(根据教程中的说明编译pem文件)。一旦我创建了dev.pem我上传到我的托管提供商,并尝试运行我的PHP脚本。这是创建和安装证书的正确方法吗?



我已经用完了调试的想法。任何方向都会很棒。

解决方案

我的服务器上 dev.pem 的路径不正确。 / p>

这些说明确实是生成.pem文件的正确方法。一旦创建,它可以在任何机器上使用(而不仅仅是生成它的机器)。


I've followed the instructions at How to build an Apple Push Notification provider server (tutorial) in an attempt to set up a push notification server.

When I attempt to connect with the following PHP code

// connect to apns server
$strAPNSUrl = 'ssl://gateway.sandbox.push.apple.com:2195';
$strAPNSCert = 'dev.pem';

// generate stream
$oStreamContext = stream_context_create();
stream_context_set_option($oStreamContext, 'ssl', 'local_cert', $strAPNSCert);

// create the socket connection
$oAPNS = stream_socket_client($strAPNSUrl, $iError, $strError, 2, STREAM_CLIENT_CONNECT, $oStreamContext);

I get the following warning

Warning: stream_socket_client() [function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert

Based on what information I've been able to find on Google, the issue seems to be my certificate.

I'm generating my csr and pem files in OS X (pem files per the instructions in the tutorial). Once I have created dev.pem I am uploading it to my hosting provider and attempting to run my php script. Is this the correct way to create and "install" the certificate?

I've run out of debugging ideas. Any direction would be great.

解决方案

Path to dev.pem was incorrect on my server.

The instructions are indeed the correct way to generate the .pem file. Once created it can be used on any machine (not just the machine that generated it).

这篇关于Apple推送通知服务:证书安装服务器端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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