Php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution [duplicate]

  android-volley, mysql, php, phpmyadmin, server

I have install my UBUNTU SERVER 20.04 on my little home server.
I am trying to start a php script to put image on my phpMyAdmin database with MySQL.

This is php script that is insert on my server at http://192.168.1.16/updateinfo.php:

<?php
$user_name = "root";
$user_pass = "";
$host_name = "http://192.168.1.16/phpmyadmin";
$db_name = "dbupload";

$con = mysqli_connect($host_name, $user_name, $user_pass) or die("Unable to connect to MySQL " . mysqli_connect_error());

if ($con) {
    $image = $_POST["image"];
    $name = $_POST["name"];
    $sql = "insert into imageinfo(name) values ('$name')";
    $upload_path = "uploads/$name.jpg";


    if (mysqli_query($con, $sql)) {
        file_put_contents($upload_path, base64_decode(($image)));
        echo json_encode(array('response' => 'Image Uploaded Successfully'));
    } else {
        echo json_encode(array('response' => 'Image Uploaded failed'));
    }
} else {
    echo json_encode(array('response' => 'not connected!'));
}

mysqli_close($con);

My server have static ip 192.168.1.16 and i have phpMyAdmin on http://192.168.1.16/phpmyadmin/

My username is set to root and i remove my password ( ” ).

The response of the script is Unable to connect to MySQL php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

but when i ping www.anothersize.com it works.

How can i do?

Source: Ask PHP

LEAVE A COMMENT