我在主机文件和PHP上遇到了问题。当以主机身份运行PHP代码时,将读取/etc/ root中的条目。但不是以我的用户或apache的身份运行代码时。
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知道为什么会这样吗?
发布于 2010-07-16 19:53:04
你确定你的/etc/hosts文件是完全可读的吗?
chmod a+r /etc/hosts
https://stackoverflow.com/questions/3264264
复制相似问题