다음 스크립트 없습니다 :DNS는 PHP에서 작업 (그러나 일반적으로 않습니다)
<?php
$dnsrecs = dns_get_record('google.com'); foreach($dnsrecs as $dnsrec){ foreach($dnsrec as $label=>$val){ echo $label.':'. $val . '<br>'; } }
echo file_get_contents('https://google.com');
?>
는 (은 phpinfo 있지만, DNS 레코드 목록을 다시 부여하지만, file_get_contents에 실패 끝)는 말한다 :
다음과 같은 오류와allow_url_fopen On On
allow_url_include Off
: 서버의 작동에
PHP message: PHP Warning: file_get_contents(https://google.com): failed to open stream: php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /var/www/a.php on line 5" while reading response header from upstream, client: 152.66.34.10, server: xxx, request: "GET /a.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-www.sock:", host: "xxx"
DNS 해상도, 동일한 사용자와의 nginx가 실행되는 :
# sudo -u www-data host google.com
google.com has address 216.58.212.142
google.com has IPv6 address 2a00:1450:400e:800::200e
google.com mail is handled by 50 alt4.aspmx.l.google.com.
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.
내 PHP 버전은 최근의 : 제대로
# php --version
PHP 5.5.9-1ubuntu4.21 (cli) (built: Feb 9 2017 20:54:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
내가 PHP5-FPM를 통해 그것을 실행하고, 그리고 그와 관련된 것으로 보인다, sudo -u www-data php a.php
때문에 작동합니다. http://pastebin.com/qZePJdT5 그리고 내은 phpinfo은 여기에 있습니다 : :
내 php.ini 파일은 여기 http://pastebin.com/cAWuu8wr
감사합니다.
php-fpm을 다시 시작하면 나를 위해 문제가 해결되었습니다. 나는 Google DNS 서버를 사용하지 않고있다. –
URL (www.example.com)과 독립적으로 어제 밤부터 PHP-FPM에서 DNS에 '호스트 이름과 연결된 주소가 없습니다'라는 문제가있었습니다. php5-fpm을 다시 시작하면 도움이되었지만, 잠시 동안 만 가능합니다. – BurninLeo
@hassan에 의하면, 우분투 업데이트로 인해 문제가 발생했을 가능성이 매우 높습니다 (http://stackoverflow.com/questions/42956679/wordpress-wp-remote-post-gives-curl-error-6-could-not- resolve-host/42957214 # 42957214). 업데이트를 설치하고 서비스를 다시 시작하면 트릭을 수행해야합니다. – BurninLeo