PHP Error: getaddrinfo failed: Temporary failure in name resolution in /home/

Any PHP programmer guru here. Kindly assist. This script was working fine, but now has issues.

 mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/.../line#

thank you

At what point are you getting the error?
Paste the entire script here

1 Like

who is the admin there?

Hi, the entire script has the site name that the client may not want exposed. Let me change the dbase name and post shortly.

Ata mimi nashindwa hakuna code…wharrithis???
Send the entire script.

It points at this line. I’m not sure what i could have changed. Coz the only thing i changed was some page names. Like Site title, h1 and h2. The file is called class.php

 $this->db = new mysqli($this->configs->host, $this->configs->username, $this->configs->pass, $this->configs->database);

This is barely enough to do an analysis…the error could be carried over from a simple ; you have missed somewhere above this line of code.

Ok, here is the full Error Code as it appears on the error log. I have only changed the database name to :XXXXXXXXX

[04-Aug-2017 17:29:39 UTC] PHP Warning:  mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/XXXXXXXXXX/public_html/includes/class.php on line 116

And here is the line 116 in the file class.php that it is pointing to:

 $this->db = new mysqli($this->configs->host, $this->configs->username, $this->configs->pass, $this->configs->database);

Can you do a diagnosis with that?

is it a remote DB, if yes, are you using an IP for the HOST or a HOSTNAME, error seems to indicate that you might be using the latter and the HOSTNAME is unresolvable

Hi, please, am a little new in php. Break it down. I’m hosting it on a server. It’s a website that is live.

Your naming scheme might be wrong: wrong ip address or host name.

I only understand ramdisk error compiling resources failed

Sure. I think its the naming. Coz i changed some names in the $Config file. The problem is to figure out which one. Since its hard coded. Wasn’t tracking changes.

which servers/addresses are you targeting?

try using the ip address not host name

$host = "ip address";

Elder, it looks like you are using a static IP address whereas your server is having a dynamic IP. Please read khans response
https://stackoverflow.com/questions/6275535/php-error-php-network-getaddresses-getaddrinfo-failed-while-getting-informat

what @amun is asking is if both the application and database server are running on the same machine. If yes then in your config file you can use

$host = "localhost";

or

$host = "127.0.0.1";

Thanks Guys. Havent resolved it fully but this has give me some headway. Let me try changing the DNS. And hostname.

I have hosted the site. It’s online. Not on 127.0.0.1