|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60660 curl_errno returns 0 instead of 6
Submitted: 2012-01-04 21:16 UTC Modified: 2012-01-06 16:19 UTC
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: bart at ajaxer dot net Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.3.8 OS: Win XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bart at ajaxer dot net
New email:
PHP Version: OS:


 [2012-01-04 21:16 UTC] bart at ajaxer dot net
This issue concerns only multi curl.

Single handle curl works correct and returns error no. 6 when host is not resolved.

In the same situation multi curl returns 0 with curl_errno function despite the fact that curl_error returns error message.

See codes of 2 examples below

Test script:
// Create a curl handle to a non-existing location
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '');

// Execute

// Check if any error occured
    echo 'Curl error: ' . curl_error($ch) . ' - ' .curl_errno($ch);

// Close handle


// create both cURL resources
$ch1 = curl_init();

// set URL 
curl_setopt($ch1, CURLOPT_URL, "");

//create the multiple cURL handle
$mh = curl_multi_init();


$active = null;
//execute the handles
do {
    $mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);

while ($active && $mrc == CURLM_OK) {
    if (curl_multi_select($mh) != -1) {
        do {
            $mrc = curl_multi_exec($mh, $active);
        } while ($mrc == CURLM_CALL_MULTI_PERFORM);

echo 'Curl error: ' . curl_error($ch1) . ' - ' .curl_errno($ch1);

//close the handles
curl_multi_remove_handle($mh, $ch1);

Expected result:
in first example:
Curl error: Could not resolve host:; Host not found - 6

in second:
Curl error: Could not resolve host: (nil); Host not found - 0


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-06 16:19 UTC]
-Status: Open +Status: Bogus
 [2012-01-06 16:19 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

If you're using curl_multi_exec you need to use curl_multi_info_read to get the 
curl error code
 [2012-02-24 05:04 UTC] cem at namekan dot org
This bug is still not fixed
 [2021-09-27 23:59 UTC] michael dot vorisek at email dot cz
Please help fixing this bug. The issue is present when curl_multi is used and curl_errno($ch, ...) should be supported.

Currently, there is no way of identifying failures (not trusted certificate, connection timeout, ...) when curl_multi is used.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Aug 14 14:05:59 2022 UTC