allow_url_fopen在服务器中不起作用? [英] allow_url_fopen not working in server?

查看:58
本文介绍了allow_url_fopen在服务器中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的项目使用ups服务,我有以下代码可以在我的本地主机上正常工作

I am using ups service for my project,I have the following code which is working fine in my localhost,

.......
 $fp = fopen($url, "r");    
      while(!feof($fp)){ 
        $result = fgets($fp, 500);
        $result = explode("%", $result);
         //print_obj($result);
        $errcode = substr($result[0], -1);
        switch($errcode){
          case 3:
            $returnval = $result[8];
                break;
          case 4:
            $returnval = $result[8];
            break;
          case 5:
            $returnval = $result[1];
            break;
          case 6:
            $returnval = $result[1];
            break;
        }
      }
      fclose($fp);
.....

但是 fopen 在我的服务器上不起作用,我检查了ini设置 allow_url_fopen On 已启用.我还有其他设置吗?请对此提供建议.

But fopen is not working in my server, i checked ini settings allow_url_fopen On has been enabled already. Is there any other settings i missed. Kindly advice on this.

推荐答案

出于安全原因,在某些服务器中,网络管理器禁止访问遥远的url(端口上的传出流量).我以前曾多次看到这个问题.可能是因为这个原因.

In some servers, access to distant url ( outgoing traffic on port ) are disabled by network managers, for security reasons. I saw this problem many times before. It may be for this reason.

如果这是原因,并且您知道必须请求的URL(和服务器IP),则可以请求添加一些iptables规则以允许访问该URL.

If it's the reason and you know what url ( and server IP ) you have to request, you can ask for adding some iptables rules to allow access to that URL.

这篇关于allow_url_fopen在服务器中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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