简体   繁体   中英

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.

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.

-----BEGIN CERTIFICATE-----
<certificate details>
-----END CERTIFICATE-----
-----BEGIN ENCRYPTED PRIVATE KEY-----
<private key>
-----END ENCRYPTED PRIVATE KEY-----

mine was fixed once i moved the correct pem file

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.

ie using

$location = "file.pem";

rather than

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

Can you post your code so we can check it?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM