无法设置本地证书链文件

无法设置本地证书链文件

本文介绍了推送通知错误:"无法设置本地证书链文件"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个测试PHP页面,只是发出一个通用的推送通知和间歇工作。有时,它提供的消息,其他时间我得到这个错误:

I wrote a test php page that just sends out a generic push notification and it works intermittently. Sometimes it delivers the message and other times I get this error:

消息:在stream_socket_client()[function.stream插槽客户端]:无法设置本地证书链文件`/var/www/ninerobot.com/public/mlb/certs/mlbtr-push-dev.pem ;检查您的凭证档案错误/ capath设置包括证书颁发者的详细信息。

"Message: stream_socket_client() [function.stream-socket-client]: Unable to set local cert chain file `/var/www/ninerobot.com/public/mlb/certs/mlbtr-push-dev.pem'; Check that your cafile/capath settings include details of your certificate and its issuer"

你知道如何解决这个问题呢?

Do you know how I can solve this issue?

我看到,苹果的文档它说:注意:要建立的APN TLS会话,一个委托安全CA根证书必须与供应商的服务器上安装如果服务器正在运行Mac OS X,这根证书已经。在钥匙串。在其它系统,证书可能无法使用,你可以从委托SSL证书的网站此证书。这是否意味着什么,我需要做什么?

I see that on Apple's docs it says "Note: To establish a TLS session with APNs, an Entrust Secure CA root certificate must be installed on the provider’s server. If the server is running Mac OS X, this root certificate is already in the keychain. On other systems, the certificate might not be available. You can download this certificate from the Entrust SSL Certificates website." Does this mean anything that I need to do?

推荐答案

我也得到了更多的斗争做同样的。最后我终于找到解决方案,通过PHP全局URL发送推送通知。试试下面的步骤。我希望你们都知道,产生3证书,多数民众赞成在这之前的 PushChat.certSigningRequest,pushkey.p12&安培; aps_development.cer(CSR,P12,CER)

Me too got more struggle to do the same. Eventually I found solution to send push notification through PHP global url. Try the below steps. Before that I hope you all know to generate the 3 certificates thats PushChat.certSigningRequest, pushkey.p12 & aps_development.cer (csr,p12,cer)

打开终端和步步运行下面的命令,那就是粗体字母

$ CD〜/桌面/ //确保终端指的是您正确的证书路径。

$ cd ~/Desktop/ //Make sure terminal refers your correct certificate path.

$远程登录gateway.sandbox.push.apple.com 2195 //询问系统管理员打开如果没有连接

$ telnet gateway.sandbox.push.apple.com 2195 // Ask system administrator to open if its not connected

尝试17.110.227.35 ...
连接到gateway.sandbox.push-apple.com.akadns.net。

Trying 17.110.227.35...Connected to gateway.sandbox.push-apple.com.akadns.net.

转义字符是'^]'。

$ OpenSSL的X​​509 -in aps_development.cer -inform德退房手续PushCert.pem //转换.CER为.pem

$ openssl x509 -in aps_development.cer -inform der -out PushCert.pem //Convert .cer to .pem

$ OpenSSL的PKCS12 -nocerts退房手续PushKey1.pem -in pushkey.p12 //转换的.p12为.pem。输入您的通行证pharse这是在创建的.p12证书,你给了同样的PWD。 PEM密码短语也一样的.p12证书。

$ openssl pkcs12 -nocerts -out PushKey1.pem -in pushkey.p12 //Convert .p12 to .pem. Enter your pass pharse which is the same pwd that you have given while creating the .p12 certificate. PEM pass phrase also same as .p12 cert.

输入导入口令:

MAC核实确定

输入PEM密码短语:

验证 - 输入PEM密码短语:

Verifying - Enter PEM pass phrase:

$ OpenSSL的RSA -in PushKey1.pem退房手续PushKey1_Rmv.pem //要为关键的全局访问删除passpharse。这不仅解决了我在stream_socket_client()及证书capath警告。

$ openssl rsa -in PushKey1.pem -out PushKey1_Rmv.pem //To remove passpharse for the key to access globally. This only solved my stream_socket_client() & certificate capath warnings.

输入密码短语PushChatKey1.pem:

Enter pass phrase for PushChatKey1.pem:

写的RSA密钥

$猫PushCert.pem PushKey1_Rmv.pem> ApnsDev.pem //将两个.pem文件到一个文件中。

$ cat PushCert.pem PushKey1_Rmv.pem > ApnsDev.pem // To join the two .pem file into one file.

然后最后移动SimplePush.php到ApnsDev.pem文件位置。两个文件都将在同一个文件夹。和更改设备令牌,通Pharase,证书名称( ApnsDev.pem ),消息...在simplepush.php下载使用下面的URL文件。
http://d1xzuxjlafny7l.cloudfront.net/downloads/SimplePush.zip
然后在终端执行该文件或域服务器

Then Finally move the SimplePush.php to the ApnsDev.pem file location. Both files will be in same folder. and change Device Token, Pass Pharase, Certificate Name(ApnsDev.pem), Message… In simplepush.php Download the file using the below URL.http://d1xzuxjlafny7l.cloudfront.net/downloads/SimplePush.zipThen execute the file in terminal or your domain server

$ PHP simplepush.php

www.Domainname.com/push/simplepush.php //现在,链接显示已连接到成功交付APNS信息'。

www.Domainname.com/push/simplepush.php // Now, url shows 'Connected to APNS Message successfully delivered'.

多数民众赞成它,推送通知将飞行并达到特定的iOS设备。

Thats it, the push notification will fly and reach the specific IOS device.

如果您想发送'徽章'然后更改净荷code在simplepush.php像下面,
//构造通知负载体:

If you want to send 'Badge' then change the payload code in simplepush.php like below,// Construct the notification payload body:

$徽章= 1;

$声音='默认';

$sound = 'default';

$ =体阵列();

$body = array();

$体['APS'] =阵列('警报'=> $消息);

$body['aps'] = array('alert' => $message);

如果($标志)

$body['aps']['badge'] = $badge;

如果($音)

$body['aps']['sound'] = $sound;

//配置结束

// EN code中的有效载荷为JSON:

// Encode the payload as JSON:

$有效载荷= json_en code($体);

$payload = json_encode($body);

现在再次运行PHP文件和应用程序图标,证件号码显示为红色圆圈。

Now run the php file again and the app icon appears with badge number in red circle.

这篇关于推送通知错误:"无法设置本地证书链文件"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 13:24