stream_socket_client 无法连接(连接超时) [英] stream_socket_client unable to connect (connection timed out)

查看:363
本文介绍了stream_socket_client 无法连接(连接超时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用证书和私钥

$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://gateway.xyz.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);

它在我本地的 XAMPP 服务器上运行,但它在外部服务器上不起作用:

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

警告:stream_socket_client() [function.stream-socket-client]:无法连接到/home/biranchi/public_html/中的 ssl://gateway.sandbox.push.apple.com:2195(连接超时)第 42 行的 push.php

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out) in /home/biranchi/public_html/push.php on line 42

连接失败 110

错误是什么?我需要更改服务器中的某些设置吗?

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

推荐答案

我通过在生产服务器上打开端口 2195 解决了这个问题.您可以通过以下命令验证 $telnet gateway.push.apple.com 2195

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

-bash-3.2# telnet gateway.push.apple.com 2195

Trying 17.149.38.141...
Connected to gateway.push.apple.com (17.149.38.141).
Escape character is '^]'.
Connection closed by foreign host.

这篇关于stream_socket_client 无法连接(连接超时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆