WDlinux官方论坛's Archiver

icecms 发表于 2015-9-23 16:24

关于虚拟空间下使用wget的问题

使用的是wdcp面板开出来的虚拟空间

源代码[code]
<?php       
        $url="http://wget.icecms.cn/offline-download-master.zip";//这个文件被我删了,测试的话换其他链接。。
        $allow_type = array("wmv","apk","deb","iso","xls","xlsx","exe","cpp","pdf","gif","mp3","mp4","zip","rar","doc","docx","mov","ppt","pptx","txt","7z","jpeg","jpg","JPEG","png");
        $torrent = explode(".",$url);
        $Suffix = end($torrent);//end()函数将数组内部指针指向最后一个元素,并返回该元素的值(如果成功)
        $Suffix = strtolower($Suffix);//函数把字符串转换为小写。
        if(in_array($Suffix,$allow_type)){
            echo $msg="上传成功,正在后台下载,待会回来看上传结果";
            echo  shell_exec("wget -b -nc -o /tmp/output.txt --restrict-file-names=nocontrol -P ./download http://wget.icecms.cn/offline-download-master.zip " . escapeshellarg($url));
           // echo "wget -b -nc -o /dev/null --restrict-file-names=nocontrol -P ./download " . escapeshellarg($url);
        }
        else  {
           echo  $msg="请勿上传非法文件或者无效链接";
        }
//        $a = system("dir",$out);
//        print_r($a);
//        print_r($out);
?>
[/code]用php执行 上面代码后提示  Continuing in background, pid 26540,好像返回成功了,但是实质上没有成功下载文件,(然后我直接在xshell上面执行wget语句却能够正常下载)

我查看了一下,日志 下wget时提示

Resolving wget.xxx.cn... failed: Temporary failure in name resolution.

wget: unable to resolve host address `wget.xxx.cn'



百度了一下,解决办法
解决办法:

登入root(VPS)。

进入/etc/resolv.conf。

修改内容为下

nameserver 8.8.8.8 #google域名服务器

nameserver 8.8.4.4 #google域名服务器

按照以上设置之后,,还是不可行(已经重启服务器)




ps www已有shell_exec()执行权限

求可行的解决办法
谢谢

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.