Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple pushnotification

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.

like image 336
Vicky Dev Avatar asked Nov 05 '22 01:11

Vicky Dev


1 Answers

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

$location = "file.pem";

rather than

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

Can you post your code so we can check it?

like image 135
P4ul Avatar answered Nov 11 '22 02:11

P4ul