当前位置 主页 > 服务器问题 > Linux/apache问题 >

    linux服务器中的远程访问问题小结

    栏目:Linux/apache问题 时间:2018-12-14 14:11

    在php程序中运用fopen或者socket的时候,报一下错误php_network_getaddresses: getaddrinfo failed: Temporary failure in name 在php程序中运用fopen或者socket的时候,报一下错误:

    php_network_getaddresses: getaddrinfo failed: Temporary failure in name。

    我的代码如下

    $handle = fopen(“http://www.baidu.com/”, “r”);
    echo “handle:”.$handle;

    这表示是无法连接到服务器,而我http://www.baidu.com/是可以访问的

    这是服务器的防火墙的问题。将防火墙关闭掉,重启apache就可以了:

    【root】#service iptables off

    【root】#/etc/rc.d/init.d/named restart

    (如果报错,先执行:yum install caching-nameserver,再执行以上命令)

    【root】# pkill httpd

    【root】# /usr/local/apache2/bin/httpd -k restart

    当然还有可能是服务器的dns解析问题,请查看相关的文档。