当我将file_get_contents或curl_exec与url(http://google.com或其他)一起使用时,返回false与不同的上下文,user_agent等...没有错误没有警告
使用本地文件,例如:file_get_contents("a.txt");
配置:
Php.ini是对的: allow_url_fopen = On
无防火墙: sudo ufw status:inactive
PHPINFO():
协议:dict,file,ftp,ftps,gopher,http,https,imap,imaps,ldap,ldaps,pop3,pop3s,rtmp,rtsp,smtp,smtps,telnet,tftp
主持人:x86_64-pc-linux-gnu
SSL:版本OpenSSL / 1.0.1e
OpenSSL:支持启用
OpenSSL:Library Version OpenSSL 1.0.1e 2013年2月11日
OpenSSL:标题版本OpenSSL 1.0.1e 2013年2月11日
这是一个专用服务器,可能有物理防火墙吗?或者我无法控制的东西?
非常感谢
答案 0 :(得分:0)
Thank you all so much for your comments:
Does running wget or curl on the command line of that server work? – apokryfos
Exactly was a server error not a php issue, i just use the easy way to fix it:
After some minutes trying to find something wrong with resolv.conf,head,.d
Just use this solution if you didn't modify nothing manually and you don't have a customized resolv
.I've removed resolvconf:
aptitude purge resolvconf
And i installed it again:
apt-get install resolconf