Biranchi Biranchi - 1 year ago 713
PHP Question

stream_socket_client unable to connect (connection timed out)

I am using the certificate, and the private key

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $certfile);
stream_context_set_option($ctx, 'ssl', 'passphrase', $pass);
$fp = stream_socket_client('ssl://', $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);

Its running in my local XAMPP Server, but its not working in the external server:

Warning: stream_socket_client() []: unable to connect to ssl:// (Connection timed out) in /home/biranchi/public_html/push.php on line 42

Failed to connect 110

What is the error? Do i need to change some setting in the server?

Answer Source

I had fixed the issue by opening the port 2195 on the production server. You can verify by following command $telnet 2195

-bash-3.2# telnet 2195

Connected to (
Escape character is '^]'.
Connection closed by foreign host.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download