Php 苹果推送通知

Php 苹果推送通知,php,linux,ssl,push-notification,Php,Linux,Ssl,Push Notification,我在路径中有一个PHP脚本,如/var/www/vhosts/hostname/httpdocs/webservices,我在那里有PHP脚本和.pem文件,并且我在脚本中正确调用了.pem文件,但当我运行脚本时,我仍然没有收到推送通知,而是收到如下警告: Warning: stream_socket_client() [function.stream-socket-client]: Unable to set local cert chain file `ck_push_test.pem';

我在路径中有一个PHP脚本,如
/var/www/vhosts/hostname/httpdocs/webservices
,我在那里有PHP脚本和
.pem
文件,并且我在脚本中正确调用了
.pem
文件,但当我运行脚本时,我仍然没有收到推送通知,而是收到如下警告:

Warning: stream_socket_client() [function.stream-socket-client]: Unable to set local cert chain file `ck_push_test.pem'; Check that your cafile/capath settings include details of your certificate and its issuer in /var/www/vhosts/ipartyapps.com/httpdocs/webservices/testPush.php on line 12

Warning: stream_socket_client() [function.stream-socket-client]: failed to create an SSL handle in /var/www/vhosts/ipartyapps.com/httpdocs/webservices/testPush.php on line 12

Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /var/www/vhosts/ipartyapps.com/httpdocs/webservices/testPush.php on line 12

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.push.apple.com:2195 (Unknown error) in /var/www/vhosts/ipartyapps.com/httpdocs/webservices/testPush.php on line 12
Failed to connect 0

我仔细检查了脚本和
.pem
文件的所有路径、权限和所有者/组,仍然没有收到推送通知。

可能是因为您无意中试图在运行脚本的目录中查找.pem文件,而不是相对于.php脚本文件查找该文件

i、 e.使用

$location = "file.pem";
而不是

$location = dirname(__FILE__)."/file.pem";

您可以发布您的代码以便我们检查吗?

您是否检查了您使用的pem文件是否正确?(连接了私钥和证书的那个?)

打开pem文件,检查它是否有证书和私钥,如下所示

-----BEGIN CERTIFICATE-----
<certificate details>
-----END CERTIFICATE-----
-----BEGIN ENCRYPTED PRIVATE KEY-----
<private key>
-----END ENCRYPTED PRIVATE KEY-----
----开始证书-----
-----结束证书-----
-----开始加密私钥-----
-----结束加密私钥-----

一旦我移动了正确的pem文件,我的问题就解决了。这听起来不仅仅是检查一些本地权限:“检查您的cafile/capath设置是否包括您的证书及其颁发者的详细信息”您能告诉我“cafile/capath”设置是什么意思吗?在哪里查找它们或如何更改它们吗?@VIVEK nope,很抱歉似乎与OpenSSL有关。这个问题最好在serverfault.com上解决,投票迁移到那里。@Pekka:同意“离题”的说法,但也许是因为?@David hmmm,我认为serverfault上的人更适合解决潜在的证书问题。它可能会在Linux命令行上进行排序