php_network_getaddresses: getaddrinfo failed

…衆ロ難τιáo~ 提交于 2019-12-11 00:54:34

问题


I am getting this error in all the functions of Image GD library.

$im = @imagecreatefromjpeg("src/bg.jpg") or die('Cannot Initialize new GD image stream');
function copyImage1($im, $dp1_name, $x1, $y1){
    $dp1 = imagecreatefromjpeg($dp1_name);
    list($w1, $h1) = getimagesize($dp1_name);
    imagecopy($im, $dp1, 35, 130, 0, 0, $w1, $h1);
}
function copyImage2($im, $dp2_name, $x2, $y2){
    $dp2 = imagecreatefromjpeg($dp2_name);
    list($w2, $h2) = getimagesize($dp2_name);
    imagecopy($im, $dp2, 618, 125, 0, 0, $w2, $h2);
}

$box = imagettfbbox(30, 0, "src/font.ttf", $user_name);
imagettftext($im, 23, 0, 53, 348, imagecolorallocate($im, 73, 184, 227), "src/font.ttf", "hello");
imagettftext($im, 23, 0, 628, 348, imagecolorallocate($im, 73, 184, 227), "src/font.ttf", "byr");
copyImage1($im, "http://graph.facebook.com/100001504336690/picture?width=153&height=143", 10, 10);
copyImage2($im, "http://graph.facebook.com/100001504336690/picture?width=138&height=158", 10, 10);

$file_name = "dump/" . rand(1000, 9999) . "-id-" . rand(1000, 9999) . ".jpg"; 
imagejpeg($im, $file_name, 80);
imagedestroy($im);


?>

The files are available at their place,

Code was working fine but now it is not working. I don't know wyy it is not working now..


回答1:


The server that is running this code has DNS servers which it uses to resolve domain names, in this case, graph.facebook.com. It's either that those DNS servers are down or the server is misconfigured and can't reach whatever DNS servers it's supposed to use.




回答2:


Restarting apache server also resolved my issue. I recently moved to a dedicated server so there were some initial DNS issues.




回答3:


The problem is solved, it just needed a apache restart.



来源:https://stackoverflow.com/questions/18885496/php-network-getaddresses-getaddrinfo-failed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!