Apache and php don't have DNS ?

5 posts / 0 new
Last post
#1 Wed, 01/25/2012 - 15:43
fredv

Apache and php don't have DNS ?

Hi,

in my website, i'm getting information from another site with curl_url and curl_exec functions. On Virtualmin it doesn't work because it seems not to be able to access DNS to translate the url

same with file_get_contents("http://www.google.com")

i get an error : failed to open stream: php_network_getaddresses

what can i do to allow my php/apache to get url resolved ?

thanks

Wed, 01/25/2012 - 16:03
andreychek

Howdy,

You may want to make sure that DNS resolution is currently working on your system.

For example, what output do you get when running this command:

host google.com

Wed, 01/25/2012 - 16:09 (Reply to #2)
fredv

Hi,

everything works when i'm in console only php seems to be unable to resolve dns

host google.com

google.com has address 173.194.67.104 google.com has address 173.194.67.105 google.com has address 173.194.67.106 ...

Thu, 01/26/2012 - 12:47 (Reply to #3)
fredv

oh, i have found the fix !

in BIND's config i had put recursion no;

now i have put : recursion yes; allow-recursion { 127.0.0.1; };

it works fine now

Thu, 01/26/2012 - 13:06
andreychek

Howdy,

Hmm, well that's unusual! I'm surprised that worked from the command line, but not from Apache/PHP.

However, I'm glad you found the fix, thanks for sharing that!

-Eric

Topic locked