4
votes

Why am I getting this errors:

Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure

Warning: stream_socket_client(): Failed to enable crypto

Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) Failed to connect: 0

I am sending this php page with a cron job and the code error is referring to this:

$fp = stream_socket_client(
'ssl://gateway.sandbox.push.apple.com:2195', $err,
$errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);

Which is very strange because the exact same code is on another two php pages and it works perfectly.

I also copied and pasted the exact same code from one page where it was working to a brand new one and it didn't work... I don't see how that can make sense!

1

1 Answers

6
votes

Most likely your script is not seeing the certificates, it could be as simple as the wrong path to the certificate key.

Putting the full path to the certificate is a good idea.