Mak
Mak

Reputation: 20453

Wrong DNS Settings, php_network_getaddresses: getaddrinfo failed Name or service not known, nslookup

The problem originally looked like this:

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home///ppk_hotweb.class.php on line 58

I used cURL as well, it just returned null, that's it.. Both (file & cURL) were enabled.

Tried file_get_contents('google.com') and it worked!

Why doesn't file_get_contents('domain.com.au') work then?

So I started reading relevant stackoverflow posts and people say that this is a DNS settings issue.

I tried the following:

> # ping domain.com.au
ping: unknown host domain.com.au

What's wrong with the host? The site is live.

Also:

# nslookup domain.com.au
Server: 203.16.60.
Address: 203.16.60.
#53

*** Can't find domain.com.au: No answer

and

> # dig domain.com.au

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6_3.2 <<>> domain.com.au
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52814
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;domain.com.au.          IN      A

;; AUTHORITY SECTION:
domain.com.au.   3600    IN      SOA     ns1.web24.net.au. dns.web24.net.au. 2012080201 7200 3600 604800 3600

;; Query time: 1 msec
;; SERVER: 203.16.60.***#53(203.16.60.3)
;; WHEN: Sat Aug  4 05:43:23 2012
;; MSG SIZE  rcvd: 92

I'll really appreciate any help! Thanks.

UPD: btw, just tried the Whois lookup...

domain.com.au is not available

:(

Upvotes: 5

Views: 41890

Answers (2)

Vahid Alvandi
Vahid Alvandi

Reputation: 612

you can use this command without https like bellow

 php -r "readfile('http://symfony.com/installer');" > symfony

Upvotes: -2

drew010
drew010

Reputation: 69957

The DNS server being used by your server may be using old cached DNS records since looking up that host works for me.

My dig results also return a valid A record which yours doesn't appear to.

This probably won't change anything given the DNS issues, but

file_get_contents('domain.com.au');

should be:

file_get_contents('http://domain.com.au');

Using the first option will try to locate a local file rather than using the http wrapper.

If you have permission, try changing the name servers in your /etc/resolv.conf file to other nameservers.

Upvotes: 5

Related Questions