自从更换台湾主机之后,访问速度有了明显的提升,可是今天登陆后台发布文章的时候,出现如下错误提示:
Warning: fsockopen() has been disabled for security reasons in /home/~/domains/luckb.com/public_html/wp-includes/class-snoopy.php on line 1142
Warning: fsockopen() has been disabled for security reasons in /home/~/domains/luckb.com/public_html/wp-includes/class-snoopy.php on line 1142
Warning: Cannot modify header information – headers already sent by (output started at /home/~/domains/luckb.com/public_html/wp-includes/class-snoopy.php:1142) in /home/~/domains/luckb.com/public_html/wp-includes/pluggable.php on line 868
重新下载Wordpress程序,替换以后不停刷新,还是错误照旧,刚开始的时候确实有些着急,联系虚拟主机的客服,得到的答复是Wordpress主机linux服务器为了考虑安全性,服务器关闭了fsockopen()函数,唯一的方法只能通过升级虚拟主机解决。NND,不能因为服务器禁用了fsockopen()函数,就要更换主机吧,应该会有解决方法的,功夫不负有心人,还真被我给找到了解决方法,好东西分享给大家:
方法一:经过phpinfo()查看确实没有启用fsockopen()和pfsockopen()两函数,在错误提示文件wp-includes/class-snoopy.php的文件头添加:
@error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
方法二:打开错误提示文件wp-includes/class-snoopy.php的文件,将fsockopen()函数替换成@fsockopen()函数即可
if($fp =@fsockopen(
$host,
$port,
$errno,
$errstr,
$this->_fp_timeout
))
{
// socket connection succeeded
return true;
}
用的美国VPS,没有出现这样的问题