Vicky Dev
Vicky Dev

Reputation: 2173

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.

Upvotes: 5

Views: 3066

Answers (2)

Sahan Maldeniya
Sahan Maldeniya

Reputation: 1046

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

Upvotes: 1

P4ul
P4ul

Reputation: 770

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?

Upvotes: 1

Related Questions