title: /etc/hosts doesn't affect PHP
body: <p>I'm having problems with the hosts file and PHP. When running the PHP code as <code>root</code>, the entries from /etc/hosts are read. But not when running the code as my user, or from apache.</p>
  
  <pre><code>root@server:/# cat /etc/hosts
  127.0.0.1       mydomain.com
  
  root@server:/# php -r "echo gethostbyname('mydomain.com');"
  127.0.0.1
  
  markus@server:/$ php -r "echo gethostbyname('mydomain.com');"
  xxx.xxx.xxx.xxx
  </code></pre>
  
  <p>Any idea why this is?</p>