fopen fails with getaddrinfo failed

后端 未结 2 659
眼角桃花
眼角桃花 2021-01-03 11:35

I am having problems with the following code:

function http_file_exists($url){
$f=fopen($url,\"r\");
if($f){
    fclose($f);
    return true;
}          


        
2条回答
  •  别那么骄傲
    2021-01-03 12:04

    Rebooting a UNIX server is extremely unlikely to fix a problem. It looks like you need to check your nameserver configuration on the server. On the console of the web server (logged in as the php user, probably apache or www-data), test

    dig www.minhemmelighed.dk
    

    If this outputs an error message, check your /etc/resolv.conf. Comment out all lines and add

    nameserver 8.8.8.8 # Google's public DNS server
    

    If that solves the problem, contact the administrator of the original nameserver (or just use Google's 8.8.8.8). If it doesn't, check your connectivity and firewalls.

提交回复
热议问题