5

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

:(

Machavity
  • 30,841
  • 27
  • 92
  • 100
Mak
  • 19,913
  • 5
  • 26
  • 32
  • The answer is to correct your `/etc/hosts`. Make sure the url points to where it should (usually localhost). – tread Jul 18 '16 at 08:50

2 Answers2

5

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.

Mak
  • 19,913
  • 5
  • 26
  • 32
drew010
  • 68,777
  • 11
  • 134
  • 162
  • ya, i did not added http:// on quick hand.. it was there, anyway.. root@vmx***03 [/etc]# cat resolv.conf nameserver 203.16.60.*** nameserver 203.16.61.*** it's for now.. to what IP should/can i change it? – Mak Aug 03 '12 at 20:46
  • it's from resolver settings page: " If you do not know what to put in the boxes below and cannot contact your provider, please close this window and go though this setup at a later time." :) i really don't know what to put there :) – Mak Aug 03 '12 at 20:51
  • 3
    Try just using Google's public DNS servers in your resolv.conf file for the time being. Replace those nameserver lines with addresses `8.8.8.8` and `8.8.4.4` and see if you can resolve that host after that. – drew010 Aug 03 '12 at 21:01
  • So i will need to change it in future? – Mak Aug 03 '12 at 21:10
  • 2
    You can safely continue using those DNS servers from Google unless your server has an explicit need to use its own nameservers for resolving certain domains under your control. Since I don't know the full IP of the ones you were previously using, I can't say who controls them or what the deal was, but obviously they were serving stale DNS information and weren't fetching updated information as they should have. – drew010 Aug 03 '12 at 21:11
  • On a debian server, with the program "resolvconf" installed, you should add the name servers to the network interface instead. Editing the resolv.conf will not work. In my case I added dns-nameservers 8.8.8.8 8.8.4.4 to the eth0 stanza and solved my this error. Thanks for the help. [https://wiki.debian.org/NetworkConfiguration#Defining_the_.28DNS.29_Nameservers] – ndasusers Oct 10 '13 at 17:54
-2

you can use this command without https like bellow

 php -r "readfile('http://symfony.com/installer');" > symfony
Vahid Alvandi
  • 588
  • 9
  • 17