cURL / Mailing Lists / curl-and-php / Single Mail


Re: cURL can't resolve host through Apache/PHP, works with PHP/CLI

From: Daniel Stenberg <>
Date: Thu, 6 Sep 2007 23:46:47 +0200 (CEST)

On Thu, 6 Sep 2007, Philip Espersen wrote:

> I'm running my own webserver with FreeBSD 6.1, Apache 2.2.4, PHP 5.2.3 and
> cURL, here's info about cURL saxet from phpinfo().
> libcurl/7.16.3 OpenSSL/0.9.7e zlib/1.2.2 c-ares/1.4.0 libidn/0.6.14


> gethostbyname:
> 6Could not resolve host: (Error reading file)

libcurl uses c-ares and not the "plain" gethostbyname() function which
explains how they can end up differently.

Possibly it is a c-ares bug/problem, or possibly there's something that c-ares
wants/needs that it can't get/use when run from Apache.

Since it works outside of Apache, I have the gut feeling it is more likely to
be something related to how it is invoked within it.

  Commercial curl and libcurl Technical Support:
Received on 2007-09-06