Stream_socket_client 超时
我正在尝试调试 PHP 函数 stream_socket_client但我真的不知道怎么做。这是我遇到问题的代码:
$this->socket = @stream_socket_client(
$remote, $errno, $errstr,
$this->request->getConfig('connect_timeout'),
STREAM_CLIENT_CONNECT, $context
);
if (!$this->socket) {
throw new HTTP_Request2_ConnectionException(
"Unable to connect to {$remote}. Error: {$errstr}",
0, $errno
);
}
抛出异常,错误显示“无法连接到 tcp://www.dropbox.com:80。错误:连接超时”。此代码来自一个非常流行的 Wordpress 插件,该插件已经过充分测试。我正在使用的服务器有一些怪癖,例如我可以通过 PHP 上传或删除文件等,所以我想知道是否有任何 PHP 设置可以阻止 stream_socket_client 工作以及如何检查这些设置用于我的服务器。
I'm trying to debug the PHP function stream_socket_client but I don't really know how. This is the code that I'm having trouble with:
$this->socket = @stream_socket_client(
$remote, $errno, $errstr,
$this->request->getConfig('connect_timeout'),
STREAM_CLIENT_CONNECT, $context
);
if (!$this->socket) {
throw new HTTP_Request2_ConnectionException(
"Unable to connect to {$remote}. Error: {$errstr}",
0, $errno
);
}
The exception is thrown and the error reads "Unable to connect to tcp://www.dropbox.com:80. Error: Connection timed out". This code comes from a very popular Wordpress plugin that's been well tested. The server I'm working on has some quirks, e.g. I'm allowed to upload or remove files via PHP etc. so I'm wondering if there are any PHP settings that could prevent stream_socket_client from working and how I can check what those settings are for my server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试检查
allow_url_fopen
。请参阅:https://php.net/manual/en/filesystem.configuration.php< /a>
Try to check
allow_url_fopen
.See: https://php.net/manual/en/filesystem.configuration.php