今天在做QQ互联时遇到 PHP 无法解析域名的问题,提示Warning: file_get_contents(): couldn’t resolve host name in错误。
首先在服务器上ping graph.qq.com不通,根据经验应该是DNS服务器设置问题。修改/etc/resolv.conf文件,设置为正确的DNS服务器,再次ping graph.qq.com成功。
然后发现在命令行上执行PHP脚本没有问题,在浏览器访问程序出错,报Warning: file_get_contents(): couldn’t resolve host name in……,经过反复查找问题,最终确定为php-fpm缓存的问题,重启php-fpm问题解决。