I\'m trying to send my phone a push notification using the simple PHP tool which connects to ssl://gateway.push.apple.com:2195
, but the connection fails with the fo
I got the same error after upgrading to macOS Sierra while using php script to send push notifications.
Solution with installing certificate to
[default_cert_file] => /usr/local/libressl/etc/ssl/cert.pem
didn't help as well.
Updated to PHP v. 5.6.27, macOS Sierra 10.12.4
And after all, I found my problem. It was in the fact, that macOS Sierra updated PHP version to 5.6.27
To check it, type in Terminal
php -v
PHP 5.6.27 (cli) (built: Oct 23 2016 11:47:58)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
And here is OpenSSL changes in PHP 5.6.x
As the brief workaround, someone suggested disabling brand-new security features in the php script (in the link above, very bottom part).
Safer (and I recommend it) would be a way to setup path to entrust_2048_ca.cer explicitly like
$streamContext = stream_context_create([
'ssl' => [
'verify_peer' => true,
'verify_peer_name' => true,
'cafile' => '/path/to/bundle/entrust_2048_ca.cer',
]
]);
It works as well .