Search code examples
phpsslpush-notificationaruba

How to use stream stream_socket_client() opening an ssl connection in aruba


i'm developing a server side in php to send push notification for apple. i see on some guides that i have to create a stream_socket_client() calling with ssl apple's servers.

When i launch my script i receive that message:

Warning: stream_socket_client() [function.stream-socket-client]:
unable to connect to ssl://gateway.sandbox.push.apple.com:2195
(Unable to find the socket transport "ssl" -
did you forget to enable it when you configured PHP?)
in D:\Inetpub\webs\XXX\push.php on line 7

What can i do? do have to enable something ? help me pls!


Solution

  • You need the OpenSSL extension for which you will probably need to recompile/reinstall PHP, depending on your platform - since this appears to be Windows, you just need to run the installer again, and select OpenSSL on the "extensions" screen.

    Many stream wrappers - SSL, TLS, and HTTPS, amongst others, are not available unless your PHP instance has the OpenSSL extension. See here for details.