Find answers to your questions

Documentation

cURL error 6: diagnose a hostname resolution failure

The error curl: (6) Could not resolve host means cURL could not resolve the requested hostname. It can interrupt an update, download or API connection. On its own, it does not prove that your DNS resolver is faulty.

For a Nuagerie hosting service, start by recording the error and its context. Do not change the server’s network configuration to fix an isolated failure. The checks below help you provide useful information to our team or the responsible administrator.

1. Identify the exact error

The official libcurl reference distinguishes several situations:

  • 5: the proxy hostname could not be resolved.
  • 6: the remote hostname could not be resolved.
  • 7: connection to the host or proxy failed.
  • 28: a timeout occurred, possibly during DNS resolution.
  • 35 or 60: TLS negotiation or certificate verification failed.

Keep the full code and message. Adding -k to cURL disables a certificate check and cannot fix DNS resolution.

2. Check the hostname actually used

Compare the hostname in the error with the service’s current documentation. A typo, retired download endpoint, extra space or incorrectly expanded environment variable can explain the failure. A malformed URL may also produce another error, such as code 3.

In a command, quote the URL appropriately for the shell, for example 'https://example.com/' for a literal address. This prevents URL characters from being interpreted as shell instructions. Also check redirects and any proxy configured by the application or its environment, without exposing its credentials.

For a cPanel download, check the command in cPanel’s current documentation. Do not replace the domain with an arbitrary IP address or automatically reuse an old installation command.

3. Understand the two DNS roles

Authoritative DNS servers publish a domain’s records. The recursive resolver used by your computer or server obtains answers for its applications and may cache them. These are separate roles, explained in the IETF DNS terminology.

If an application cannot resolve a supplier’s domain, changing your own domain’s nameservers at the registrar will generally not repair that outbound connection. If the missing record belongs to your domain, its DNS administrator should check the zone and delegation instead.

4. Run focused checks

These optional examples are for Linux environments where you have authorized terminal access and the required tools, including GNU timeout. On shared hosting, ask us for help if that access is unavailable. Replace example.com with the relevant public hostname, without a protocol or path.

curl --version

timeout --kill-after=2s 10s getent ahosts example.com

timeout --kill-after=2s 10s dig -r +time=3 +tries=1 example.com A

timeout --kill-after=2s 10s dig -r +time=3 +tries=1 example.com AAAA

These commands do not change configuration or perform an HTTP download. timeout limits how long each diagnostic waits; termination by this tool is not a DNS response code.

  • getent queries the system’s configured name lookup mechanisms, which may include sources other than DNS.
  • dig performs a DNS query. Here, -r ignores preferences in its personal configuration file.
  • A requests IPv4 addresses and AAAA requests IPv6 addresses. Missing AAAA records do not necessarily prevent an IPv4 connection.

Keep the response status and responding server in the output. Test from the affected environment: success on your computer does not prove that your website’s server receives the same answer.

5. Interpret the results

  • NXDOMAIN: the requested name is reported as nonexistent. Check its spelling, validity and records with the domain’s DNS administrator.
  • SERVFAIL: the query could not be processed successfully. Authoritative server failures, incorrect delegation or failed DNSSEC validation are possible causes.
  • NOERROR without a useful address: examine the requested record type, aliases and complete response. A name can exist without an A or AAAA record usable by the application.
  • No response or a timeout: ask the network administrator to check resolver access and DNS transport. This does not establish that the remote website is down.

Different resolver answers can reflect caching, filtering or domain configuration. Google’s troubleshooting documentation covers delegation and DNSSEC issues. Do not disable DNSSEC or the firewall to bypass the symptom.

6. When the terminal works but the application fails

Command-line cURL and PHP’s cURL extension may use different versions or settings. A scheduled task, container or web process may also have a different network environment, proxy or DNS configuration. Libcurl supports different resolution mechanisms, including c-ares or DNS over HTTPS depending on its build and options.

Have the developer compare the actual requested hostname, the application’s libcurl version, IPv4/IPv6 settings and relevant caches. These details can be collected privately; publishing a phpinfo() page or detailed logs is unnecessary.

7. Choose a resolver appropriate for the service

  • Computer or office network: first check the router, Internet provider and any VPN configuration.
  • Hosted server or VPS: ask the provider which resolvers it recommends and which network constraints apply.
  • Private network or cloud environment: preserve internal name resolution and conditional forwarding. Adding a public resolver as a “secondary” does not replace those rules.

For an authorized, compatible use, standard IPv4 addresses are 8.8.8.8 and 8.8.4.4 for Google Public DNS, and 1.1.1.1 and 1.0.0.1 for Cloudflare 1.1.1.1. Their official pages also list IPv6 addresses. These are possible options, not a universal fix. Do not send internal names to a public resolver.

For a public hostname only, if your network permits it, compare A responses without changing system settings:

timeout --kill-after=2s 10s dig -r @1.1.1.1 +time=3 +tries=1 example.com A

timeout --kill-after=2s 10s dig -r @8.8.8.8 +time=3 +tries=1 example.com A

Replace the example hostname. Success here does not establish that replacing your resolver is the right correction.

On cPanel servers that use DNS blocklists for email, this choice can affect spam checks. cPanel recommends provider resolvers in this context. Some lists may reject queries from public resolvers; a rejection response is not a reliable sender reputation result.

8. Correct configuration through the right mechanism

In /etc/resolv.conf, the valid keyword is nameserver, followed by the resolver’s IP address. Configuration keywords must never be translated. The resolv.conf reference documents its syntax.

This file may be generated by a network manager or point to a local resolver service. A loopback address is therefore not automatically wrong. The administrator should identify the responsible mechanism, retain the previous settings and make a reversible change through the appropriate method. Overwriting this file can break internal resolution or be undone when network settings renew.

9. Get effective assistance

In your Nuagerie Client Area, provide the affected service, time and time zone, requested hostname, error code, application and recent changes. Attach relevant results after removing passwords, tokens, private addresses and sensitive URL parameters.

This helps us direct the investigation toward the application, domain or network involved. For external infrastructure or technical assistance, use our contact form to establish the scope of the work.

Related Articles

What is cPanel and how do you access it? cPanel is the administration interface for your hosting account. It provides the tools available to that account without granting full server-administration access. Common toolsManage website files, domains and databases.Administer email accounts when mail is hosted within that service.Review storage and resource... How can I activate my paid license after a trial? You can do this by running this command in SSH: /usr/local/cpanel/cpkeyclt It should look something like this: [root@cpanel home]# /usr/local/cpanel/cpkeyclt Updating cPanel license...Done. Update succeeded. Building global cache for cpanel...Done [root@cpanel home]# For help with a Nuagerie service, open or follow... When /cpanel, /webmail or /whm shortcuts do not work The /cpanel, /webmail and /whm shortcuts provide routes from a domain address to hosting management interfaces. An error on that route does not automatically mean your account is inaccessible. Identify the failing step so you can find the appropriate access method and give support useful observations. Start with a... How to protect a folder with a password Anyone can access subdirectories of public_html (folder containing all the public files of your hosting account) using a web browser. To restrict access to a particular directory under public_html: Connect to cPanel Click Directory Confidentiality in the Security topic. There you will find a list of subfolders.... Client Area, cPanel, email or website: choose the right sign-in The same domain name can be associated with several tools. Your Nuagerie service access, hosting panel, mailbox and website administration serve different purposes. Identifying the right account helps you avoid changing a password that will not resolve the problem. Which account do you need? Nuagerie Client Area:...