file_get_contents()函数不工作到同一台服务器 [英] file_get_contents() not working to same server

查看:275
本文介绍了file_get_contents()函数不工作到同一台服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从同一服务器域与的file_get_contents)含量(

I can't get content from same server domains with file_get_contents().

防爆。我的域名是mydomain.com

Ex. my domain name is mydomain.com


  • 从该服务器当我有的file_get_contents('http://mydomain.com')我得到错误信息:

的file_get_contents():未能打开流:连接超时

file_get_contents(): failed to open stream: Connection timed out

如果我有的file_get_contents('http://google.com')它的工作

如果我添加这个PHP脚本的file_get_contents('http://mydomain.com')来那么其他的服务器其工作。但随着当前服务器它不是。

If I add this php script file_get_contents('http://mydomain.com') to other server then its working. But with current server its not.

我的服务器:

Ubuntu 12.04
Apache 2.4.9
PHP 5.5.10

allow_url_fopen = on

apt-get的升级一切工作

推荐答案

我发现在那里有问题:

被错过了。

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:72 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:114067 (114.0 KB)  TX bytes:114067 (114.0 KB)

从$使用ifconfig

from $ ifconfig

这篇关于file_get_contents()函数不工作到同一台服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆