我的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
文件的所有路径,权限和所有者/组,仍未获得推送通知。
答案 0 :(得分:1)
您可能会收到错误,因为您无意中尝试在运行脚本的目录中找到.pem文件,而不是相对于.php脚本文件找到它。
即。使用
$location = "file.pem";
而不是
$location = dirname(__FILE__)."/file.pem";
您可以发布您的代码,以便我们检查吗?