doo6568 2018-05-02 13:04
浏览 598

无法连接到ssl://smtp.gmail.com:465名称或服务未知(0)

I have some strange problem here, socket connection to smtp.gmail.com fails when I try to execute script on site with Warning: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /var/www/test/test.php on line 2 php_network_getaddresses: getaddrinfo failed: Name or service not known (0) , but work fine if i run it in shell like php test.php, telnet works fine too and openssl connection as well, but web script just fail. I looked a lot of similar issues and didn't found an answer for that, any suggestions? I run nginx + php-fpm if, openssl enabled

UPD: here is my test script:

$fp = fsockopen("ssl://smtp.gmail.com", 465, $errno, $errstr, 10);
if (!$fp) {
    echo "$errstr ($errno)<br />
";
} else {
    echo "opened";
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 CSS实现渐隐虚线边框
    • ¥15 thinkphp6配合social login单点登录问题
    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题