歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux管理 >> Linux服務 >> linux服務器中的遠程訪問問題小結

linux服務器中的遠程訪問問題小結

日期:2017/3/2 16:31:58   编辑:Linux服務
在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解析問題,請查看相關的文檔。
Copyright © Linux教程網 All Rights Reserved