fopen fails with getaddrinfo failed

后端 未结 2 662
眼角桃花
眼角桃花 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:08

    For those of you running a very locked down distro like CentOS it is probably a security feature of SELinux as I discovered on my systems.

    At the command prompt type:

    getsebool -a | grep httpd

    and look for

    httpd_verify_dns --> off

    if this is the case you will need to set it On with the following command

    setsebool httpd_verify_dns=1

    or permanently with:

    setsebool -P httpd_verify_dns=1

    remember to restart httpd with:

    service httpd restart after every change

    I hope that helps

    Mark

提交回复
热议问题