Can't resolve domain names in php under apache Can't resolve domain names in php under apache apache apache

Can't resolve domain names in php under apache


I had the same problem.

After httpd restart host resolve problem continues. But with httpd stop & start problem solved for me.


If you have permission, try changing the name servers in your /etc/resolv.conf file to other nameservers. Might be your dns cache is old,

or try changing the SE Linux Policy by running these commands in terminal:

setsebool -P nis_enabled 1setsebool -P httpd_can_network_connect 1


I had the same problem in my development that only occurs executing php under apache, but directly with php, it works!

php filetest.php

Then I checked my apache status and I saw this in log:

Mar 12 13:01:08 arch-linux apachectl[6847]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::6aa3:c4ff:fe...is message

After some search I found it:

http://tutorialforlinux.blogspot.com.br/2013/10/solve-problem-ah00558-when-restarting.html

And this was the exaclty problem, then I changed this in my httpd.conf:

#ServerName www.example.com:80

To this:

ServerName localhost

It works, now I can resolve dns in php under apache.

Sorry about my bad english, I would like to detail more.