gpt4 book ai didi

php - Stream_socket_client 无法连接(连接超时)

转载 作者:行者123 更新时间:2023-12-03 00:59:23 38 4
gpt4 key购买 nike

我正在使用证书和私钥

$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 服务器中运行,但在外部服务器中不起作用:

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

Failed to connect 110

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

最佳答案

我通过在生产服务器上打开端口 2195 解决了该问题。您可以通过以下命令进行验证 $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.

关于php - Stream_socket_client 无法连接(连接超时),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1769189/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com