admin管理员组文章数量:1026745
I built a PHP application to establish a TCP socket connection to a mail server (SMTP server) on port 25, using a proxy. Here the main part:
$context = [
"http" => [
"proxy" => "tcp://xx.xx.xx.xx:xxxx",
"request_fulluri" => true
"header" => "Proxy-Authorization: Basic xxxxxxxxxxx"
]]
};
$connection = @stream_socket_client(
address: "tcp://$mxHost:25",
error_code: $errno,
error_message: $errstr,
timeout: 10,
context: $context
);
I built the first version of the app as a Vanilla PHP with some Symfony components, and I run it using php -S localhost:8000 -t .
and it works like a charm.
Then I decided to install Symfony, inside a Docker installation. Since I build a DDD/Clean Architecture application, it was easy to switch to a fully Symfony application.
But then the problems start.
It seems like inside Docker I cannot use stream_socket_client
correctly, I always get a connection timeout (110).
At some point I added
dns: # Custom DNS settings
- 8.8.8.8
- 1.1.1.1
to my docker-compose.yml, and it worked for one day. The day after, it stopped to works and I started again to get connection timeout.
My knowledge about network is not so strong, so I need a help.
Can someone give me a tip, a suggestion, an idea to unblock this situation?
I built a PHP application to establish a TCP socket connection to a mail server (SMTP server) on port 25, using a proxy. Here the main part:
$context = [
"http" => [
"proxy" => "tcp://xx.xx.xx.xx:xxxx",
"request_fulluri" => true
"header" => "Proxy-Authorization: Basic xxxxxxxxxxx"
]]
};
$connection = @stream_socket_client(
address: "tcp://$mxHost:25",
error_code: $errno,
error_message: $errstr,
timeout: 10,
context: $context
);
I built the first version of the app as a Vanilla PHP with some Symfony components, and I run it using php -S localhost:8000 -t .
and it works like a charm.
Then I decided to install Symfony, inside a Docker installation. Since I build a DDD/Clean Architecture application, it was easy to switch to a fully Symfony application.
But then the problems start.
It seems like inside Docker I cannot use stream_socket_client
correctly, I always get a connection timeout (110).
At some point I added
dns: # Custom DNS settings
- 8.8.8.8
- 1.1.1.1
to my docker-compose.yml, and it worked for one day. The day after, it stopped to works and I started again to get connection timeout.
My knowledge about network is not so strong, so I need a help.
Can someone give me a tip, a suggestion, an idea to unblock this situation?
本文标签: dockerPHP and streamsocketclient connection timeoutStack Overflow
版权声明:本文标题:Docker, PHP and stream_socket_client: connection timeout - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1743992119a2063024.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论