织梦dedecms无法下载远程图片解决方法

1、可能是因为服务器上禁用了fsockopen() 函数造成的,在用fsockopen()的地方用 stream_socket_client()代替就可以了。

具体修改地方是 /include/dedehttpdown.class.php 第507行

$this->m_fp = @fsockopen($this->m_host, $this->m_port, $errno, $errstr,10);

替换为

$this->m_fp = @stream_socket_client($this->m_host . ':' . $this->m_port, $errno, $errstr,10);

2、编辑php.ini,找到disable_functions,把其中的fsockopen去掉;

在用的Dedecms系统网站突然无法下载远程图片和资源,也即所谓的远程图片本地化失效。

这里由于服务器的 fsockopen函数被禁用,导致了Dedecms系统网站无法下载远程图片和资源,这才是问题所在。解决方法:

fsockopen函数被禁用解决之道:

1.进入系统程序,在include文件夹中找到pub_httpdown.php文件;

2.打开文件,找到$this->m_fp = @ fsockopen($this->m_host, $this->m_port, $errno, $errstr,10); 将这里的fsockopen替换为pfsockopen,保存,然后测试,问题解决。