PHP Curl unable to resolve some hosts

Q: Date/Time this occurred (Provide your time zone also)
A: 28/03/2023 - 3pm

Q: DevKinsta Version
A: 2.10.0 (

Q: OS Version
**A: Mac OSX Ventura 13.2.1 (22D68) **

Q: Docker Desktop Version
**A: 4.17.0 (99724) **

Q: Were any error codes or messages observed? If so, what were they?
**A: Curl error: Error cURL error 6: Could not resolve host: (see **

Q: Detailed Description of the Problem
**A: I have been working on a REST API integration using Guzzle and it suddenly stopped working and throwing the above cURL error6. The API sits at and has been working correctly for weeks. I can connect to it fine from Postman and from the same PHP code running under MAMP. For debugging I created a very simple curl script:

$handle = curl_init(); 
$url = ""; 
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
if(curl_exec($handle) === false) {
    echo 'Curl error: ' . curl_error($handle);
} else {
    echo 'Operation completed without any errors';

If I change the url in the above test script to It also can;t resolve the host.

I’ve tried chaining my network name servers to use Google’s but still no luck.

Please can anyone help tell me why it wont resolve the host domain?

I don’t want to have to use MAMP!


I found these two posts here that suggest I’m not alone with this issue:

Hey @jdgcss,
I am not able to replicate the issue :thinking: I get a proper response when using curl against that domain. Anyway, have you tried the workaround suggested in the other thread?


1 Like

Hi @Alessandro

Thanks for replying.

Yes I’ve tried a few things from there. here’s an overview.

If I open up a terminal window I can do this:


and get this response:

<META NAME="robots" CONTENT="noindex,nofollow">
<script src="/_Incapsula_Resource?SWJIYLWA=5074a744e2e3d891814e9a2dace20bd4,719d34d31c8e3a6e6fffd425f7e032f3">

Which is as expected. Now if I follow the solution in the other threads I can do this:

docker exec -it devkinsta_fpm bash
www/kinsta# curl
Could not resolve host:


/www/kinsta# dns_server update -d
<?xml version='1.0' encoding='UTF-8'?><Error><Code>MissingSecurityHeader</Code><Message>Your request was missing a required header.</Message><Details>Authorization</Details></Error>

so that solution correctly fixes the DNS issue with

However - if I try the same with my REST Api domain:

:/www/kinsta# dns_server update -d
:/www/kinsta# curl
curl: (6) Could not resolve host:

Why would it fix one and not the other do you think?

:point_up_2: that’s odd, unfortunately without being able to replicate here it’s hard to check but perhaps we can try a different workaround, by editing the host file for devkinsta_fpm.

Give it a try editing the /etc/hosts file in docker and manually specify what is the IP address that should point to.

Let us know how it goes or you need the steps needed to edit that file :crossed_fingers:

You might also want to try to add the DNS host directly as in:

dns_server add -d -A

where is the IP address of that domain.

Thank you SO MUCH - this worked like a charm :+1:

That’s great to hear! You are very welcome!


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.