If unluckily you got the “Curl: (6) could not resolve host” error, don’t worry. In this blog, we will give you 2 effective solutions to help you eliminate this error. Let’s check them out.
Why did the error “Curl: (6) could not resolve host” come up on your website?
The error message “Curl: (6) could not resolve host” generally means that the DNS (Domain Name System) server was unable to resolve the domain name associated with the website or resource being accessed.
This error can occur due to several reasons, such as enabled IPv6 No DNS Nameserver, Syntax Problem, or the website being temporarily unavailable. So how to get rid of this frustrating error? In this blog, we will provide you with some effective solutions to help eliminate this error. Now, let’s check them out.
How to eliminate the “Curl: (6) could not resolve host” error?
Method 1: Disable IPv6 to fix the error
IPv6 is the latest version of the Internet Protocol, and it’s designed to replace the older IPv4 protocol, which has limitations regarding the number of unique IP addresses it can support.
If you’re encountering the “Curl: (6) could not resolve host” error and suspect that it may be related to IPv6, you can try disabling IPv6 on your system and see if that resolves the issue.
Here is a step-by-step guide to disable IPv6 on a Linux system
- Open the Terminal and type the following command to open the network configuration file
sudo nano /etc/sysctl.conf
- Next, let’s add the following lines to the end of the files
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
- Don’t forget to save your changes and close the file
- Apply the changes by running the following command
sudo sysctl -p
Now, let’s restart your system to check if the error is gone.
Keep in mind that disabling IPv6 may cause issues with some applications or services that rely on it, so it’s recommended to re-enable it if you don’t see any improvement or if you notice other network-related issues.
Method 2: Add Google DNS server
Adding Google’s public DNS server to your system’s DNS configuration can sometimes help resolve the “Curl: (6) could not resolve host” error. Google Public DNS is a free, global DNS resolution service that can help improve the speed and reliability of your system’s internet connectivity.
Now, let’s read a step-by-step guide to adding a Google DNS server to a Linux system.
- Open Terminal -> Type su and enter in order to log in as the super user.
- Fill out the root password.
- In order to check what DNS server you are using, let’s type cat /etc/resolv.conf.
- An open DNS server maintained by Google can help you to address this trouble. They are 8.8.8.8 and 8.8.4.4 but they may change in the future. Learn more here.
- Enter vi /etc/resolv.conf in order to modify the file resolv.conf.
- Press the combination key Esc + I to insert data into the file.
- Insert # at the beginning of each line -> Fill out the two following lines in the file:
nameserver 8.8.8.8
nameserver 8.8.4.4
- Type Esc + : -> Type wp to save and exit.
Now, let’s check if the error is gone away.
Summary
The “Curl: (6) could not resolve host” error is one of the prevalent errors in the Linux system. If unfortunately, you encounter this error, you can apply the mentioned solutions above. Hopefully, they are effective for your error. If your error is not gone, please leave a comment below. We will support you in detail.
Further, if you want to own a beautiful website without touching any line of code, don’t miss our website where you explore tons of eye-catching, free WordPress themes and Joomla templates.
We’re a Digital Team from EngineTemplate with 5 content experts. Our team has 5 years exp in open source Joomla and WordPress, we make daily blogs and build useful resources for everyone who is having issues with open source while using it.
My error still isn’t gone after trying both methods above. Please help.
while running command
php artisan reviews:importing –clientId=120
i am getting the following error:
In CurlFactory.php line 210:
cURL error 6: Could not resolve host: oauth2.googleapis.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://oauth2.googleapis.com/token
Please try to recheck PHP version.