苹果推送通知
我有一个 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 文件组,仍然没有收到推送通知。
I have a PHP script located in path like /var/www/vhosts/hostname/httpdocs/webservices
, I have both PHP script and .pem
files there, and I have called the .pem
file in the script properly, but still when I run the script , I don't get push notification , instead i get warnings such as:
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
I double checked everything path, permissions and owner/group of both script and .pem
files, still not getting push notification.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能会收到错误,因为您无意中尝试在运行脚本的目录中查找 .pem 文件,而不是相对于 .php 脚本文件查找它。
即使用
而不是
您可以发布您的代码以便我们检查吗?
Possibly you are getting the error because you are unintentionally trying to find the .pem file in the directory you are running the script from rather than finding it relative to the .php script file.
i.e. using
rather than
Can you post your code so we can check it?
您是否检查过您使用的 pem 文件是否正确? (同时连接了私钥和证书的那个?)
打开您的 pem 文件并检查它是否有证书和私钥,如下所示。
一旦我移动了正确的 pem 文件,我的问题就被修复了
Have you checked that you are using the correct pem file ? (the one that has concatenated both private key and certificate? )
Open you pem file and check whether it have certificate and private key like below.
mine was fixed once i moved the correct pem file