webserver running as nobody cannot resolve domain names

Posted by jalal on Server Fault See other posts from Server Fault or by jalal
Published on 2012-04-15T15:14:13Z Indexed on 2012/04/15 17:33 UTC
Read the original article Hit count: 374

Filed under:
|
|

if i try to run the following:

<?php echo file_get_contents("http://www.yahoo.com/index.html"); ?>

through the web server I get a an "php_network_getaddresses: getaddrinfo" error.

If I run the same file from the shell with:

php test.php

then I get the expected file output.

This indicates to me that the 'nobody' user, which the webserver runs as, is not able to resolve the domain name, but the shell user can.

Any ideas on how to fix this?

Further info: CentOS 6, cPanel install, Apache, PHP running as dso.

BTW, I've tried disabling the firewall to no effect.

© Server Fault or respective owner

Related posts about dns

Related posts about centos6