• Register
0 votes
113 views

Problem :

I am new to PHP. I have written my first db.php IM USING CLOUD9 is my host.

But I am facing below error while trying to execute my code

Php_network_getaddresses getaddrinfo failed name or service not known

How to fix above error?

8 4 2
2,300 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I have read your question. It seems you have just started learning PHP.

I can explain this in simple English, this error message simply means: "I am unable to know the address of your server."

Now in technical words the error message means a hostname which you are trying to connect is not having any public nameserver record.

A database server can only be accessed by very few specific servers, it is because of the security feature just to prevent a whole world from accessing it. So everyone simply can not try to access or hack it

A host is the server which is allowed to connect to your database server which might most probably be a server you upload all your html/php/.. files to.

This error is simply caused by the network related stuff and it is not caused by your programming mistakes.

I hope the way I explained to you must so now it must be very helpful to you in resolving it.

5 2 1
4,980 points

Related questions

0 votes
1 answer 20 views
20 views
Problem: I've got this error: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known and PDO::__construct(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known. When I try to run php ... 2 week I try to solve a problem. but I could't find solution. I've already done all solution on stackoverflow.
asked Apr 25 sumaiya simi 43.9k points
0 votes
1 answer 24 views
24 views
Problem: I need assistance in resolving this problem: fsockopen(): php_network_getaddresses: getaddrinfo failed: no such host is known.
asked Apr 1 rakib1 51.5k points
0 votes
1 answer 12 views
12 views
Problem: After installing Laravel 5.5 for a new project, I get this error: [Illuminate\Database\QueryException] SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. .env db connection info: DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=lavavelproject DB_USERNAME=root DB_PASSWORD= Dev environment: Windows PHP 7.0
asked Apr 24 munim01 21k points
0 votes
1 answer 6 views
6 views
Problem The main problem is that when I use a loop with PHP mailer to blast email our users, it only gets to some, and I believe this to be a DNS issue.I need help understanding this:
asked Apr 9 neeraj 10.5k points
0 votes
1 answer 53 views
53 views
Problem: getaddrinfo: nodename nor servname provided, or not known.
asked Feb 24 Dan phillip 4.8k points
0 votes
1 answer 29 views
29 views
Problem: I also tried the raw IP address which is > ftp ftp://130.14.250.10/1000genomes/ftp/data/ But it didn't work. What is the problem here? How can I fix this? Please suggest some way?
asked Apr 10 Sana8989 8.9k points
1 vote
1 answer 20 views
20 views
Problem: Any ideas on what I need to do to fix this? socket.gaierror: [errno -2] name or service not known
asked Mar 18 MUHAMMAD MUNEEB 83k points
0 votes
1 answer 11 views
11 views
Problem: I am stuck now .. need some suggestions .. please help me .. Failed to reload daemon: the name org.freedesktop.policykit1 was not provided by any .service files
asked May 2 Ifra 37.2k points