Localhost giving an error "ERR_NAME_NOT_RESOLVED "

13,562

Solution 1

If I'm not wrong here, this is about DNS cache issue.

Before the conclusion like this is Chrome's(Browser specific) fault, try to access the same website in other web browser, such as Safari, Firefox or Internet Explorer.

NOTE: avoid testing using Opera Next - it is essentially Google Chrome with a different dress.

1. Clear DNS cache If you see the same problem you may want to flush your DNS cache.

a. In Windows, run the following command

C: > ipconfig /flushdns

b. On Linux, DNS is not cached by default. You can perform a DNS lookup to ensure it is working

$ dig -t a Page on myhostingcompany.com @domain_registrar_dns_server

c. On OSX:

$ sudo dscacheutil -flushcache

2. Disabling DNS Prefetching Google Chrome has its own DNS cache to speed up loading of webpages. This is helpful for most cases - until a website's DNS fail to resolve. You can disable DNS prefetching in Chrome by going to

Settings > Show Advanced Settings > Privacy

and disable the option Predict network actions to improve page load performance.

3. Clearing Chrome's Host Cache For the adventurous, you can also manually clear Chrome's Host Cache. Go to the address chrome://net-internals/#dns If you do not see the DNS options, click on the drop-down list on the top-left corner and select DNS. Then click on Clear host cache

Hope this help you well!

Solution 2

For all those who, like me, also end up here: I had this error due to a mistake in thinking.

  • I hosted my Laravel backend locally via xampp.
  • but then tried to access it via an app on my smartphone. In the app I then specified blabla.test (http://localhost/htdocs-path/to/project/public/) as the servers url. But of course I needed the IP address of my PC. So http://192.168.2.173/htdocs-path/to/project/public/ was the correct local server url.
Share:
13,562
user2296604
Author by

user2296604

Updated on June 22, 2022

Comments

  • user2296604
    user2296604 about 2 years

    I am trying to run a few php files using my localhost . I have wamp installed and its running fine. I created a folder in the "www" directory and the folder is visible when I run the localhost. Now I have a few .php files that I would like to run but I am unable to access them as I am receiving this error "ERR_NAME_NOT_RESOLVED "

    I researched on line and made changes to my index.php file. I changed the $suppress_localhost = true; to $suppress_localhost = false; but I am still receiving the same error.

    Any help would be appreciated.

  • user2296604
    user2296604 over 8 years
    Thank You guys for the response.
  • user2296604
    user2296604 over 8 years
    However the issue still persists I have tried it in chrome and firefox Chrome gives the error i have mentioned above and firefox gives an error "server not found". I have Cleared the DNS cache but it did not change anything . I start my wamp server then simply type localhost in the address bar to which i get the main landing page which displays various options. Once I click on the folder which has my php files this error comes up. I have put this folder in the "www" folder . Please help i am a newbie